Reputation: 69
I have written a bash script and when it is executed as
./script a b c
it is working fine. then I moved the script to the bin folder and tried to execute it as
script a b c
now it is showing error
a: No such file or directory
b: No such file or directory
c: No such file or directory
Any ideas on how to fix this?
Upvotes: 1
Views: 2254
Reputation: 2096
You execute your script with file as a parameter. When you execute by using
$ ./script a b c
parameter file and script are same location. after moving the file bin folder may be execute script from different location where your parameter file not there.
So execute your script with location of file
$ script /path/of/a /path/of/b /path/of/c
then it will be worked fine.
Upvotes: 0
Reputation: 88776
Rename your script. I suppose program script
is installed on your system.
See from your bash: man script
Upvotes: 1