0

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
1
  • 1
    See the basename command for the formatting. Commented Nov 26, 2012 at 2:57

1 Answer 1

2
for fileName in $1/*

...is probably what you mean.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.