Scripting and Programming Fundamentals

(Scripting and Programming Fundamentals) i got the flag in powershell but I could not get the flag in python 17/18 and in bash 20/21

python:
I cant get the last point for testing if the file exists
xx xxxx(‘/home/cybrary/Desktop/movies.txt’,‘r’):

Bash script:
we want to find files in /etc beginning with lowercase x:
xx /etc | xxxx ‘xx’

For Python, there are common ways to test for a file after you import os, but how can you see if a file exists without that? The hint is, can the file be opened for reading?

On BASH you want to LIST files that contain an x at the start. How do we list files? How do we test for matching criteria? How do we see if something BEGINS with “x” ?

1 Like

Joseph, thanks for the hints in python i made it but unfortunately I couldn’t do it :frowning: ls for listing x* for files starts with lower x after | i put grep

For python, how can you tell IF a file will, OPEN?

For BASH, what regex means “starts with”?

Thanks alot. I made it :slight_smile:

1 Like

image

2 Likes