Reputation: 97
I have folder "destination/" and inside the destination folder, it contains executable grade1. My current directory is "destination/"
I'm Trying to run
for i in FILES/*; do ./grade1 $i done
Which it keep says
./grade1 no such file or directory
Weird part is that, when I just copy the code to command line and run it, it works fine. Problem only arises when I do it in shell script
Upvotes: 2
Views: 6959
Reputation: 22301
I don't think that grade1 really is in your current working directory, as you claim. I suggest that you verify this also check the permissions of your executable. Extend your code to
echo current directory is $PWD
ls -l grade1
for i in FILES/*; do ./grade1 $i done
This should reveal the source of your problem.
Upvotes: 1
Reputation: 6330
One simple way to fix this problem might be to start using FULL path of grade1 executable file
for i in FILES/*; do {FULL_PATH}/grade1 $i done
Upvotes: 0