I was wondering how this looks. I am trying to create a script that will produce a text file that has a list of the files in the present working directory. How do you go about testing this script?

# Matthew Smith# Comp230
ls >FILE.txt

Save the file with a .sh extension, then add executable permissions:

$ chmod ugo+x shell-script.sh

Now run it:

$ ./shell-script.sh

Note that your current directory doesn't have to be where the script is to run it:

$ /some/path/shell-script.sh

I am a little confused as what program you need to run this code?

Also I need some help here with this code. I need to create a bash script that will copy all the files and subdirectories in one directory to a newly created directory. Here's what I came up with.

cp -R dir/*newdir/*

You pretty much have your entire script right there, assuming you don't need to be any more creative, just add a


line to the top and make it executable, etc, per the above post by John A

Best wishes,