J0natthaaann
J0natthaaann

Reputation: 575

Simple Shell Scripting

An argument example:

../path/cse/lab3/remove

Right now, it's printing out all the directory and files in 'lab3'. I want it to print out all the files in 'remove'. I'm not sure how to do that. I want to use a for loop.

Code:

if test -d $1    #check if argument is a directory.
then

    for fileName in *
    do  
        echo "what is this::: $fileName"

    done

fi

Also how do I print out all the files as strings to look something like this:

remove/test.out
remove/test2.out

Upvotes: 0

Views: 59

Answers (1)

Alexey Feldgendler
Alexey Feldgendler

Reputation: 1810

for fileName in $1/*

...is probably what you mean.

Upvotes: 2

Related Questions