Reputation: 101
I am trying to check if a file path exists and if it does to complete the pwd
command. if a file path does not exist then i want it to break and move on to the next command.
while [ -d folder1/*/stack ]; do pwd; break; done; while [<next set of commands>]...ect
i get binary operator expected
error.
Upvotes: 2
Views: 1778
Reputation: 1920
You can use ls. If ls is successfull, then pwd will run:
ls folder1/*/stack > /dev/null 2>&1 && pwd
# next command
Upvotes: 2