unix - Error when starting script : No such file or directory while executing a shell script -
I have only encountered the problem as described on
: Question by user: "I am getting: There is no such file or directory when executing the shell script, but I have this file in this file and it also has executable rights."
Answer: "Did you Started the name of your script / directory / script or ./scriptname? "
Worked for the time being, once I started the script using "./scriptname" I started this script on multiple servers and on some machines I could use "script name" and others could have "./scriptname" "Why was it necessary to" use on some machines "but not" on others "? File permission is the same on all machines.
If the current directory ( If the current directory is not in the That's because Shell will not know where this script is from - its original folder is not in the The colon is delimited, the above version means "The new path will be similar to the old path with the addition of an existing directory ( Edit: Note: @Carryl Comment - Put . )
PATH You can run a script in both ways:
will see script.sh in every directory listed in script.sh # Shell # in $ PATH ./script.sh # Shell will invite # script.sh located in the current directory.
PATH , then you have to run it like this:
./ script
PATH . Open it with
./ and tell where it got it from.
. )".
. in
PATH is not a good idea (reason for security).
Comments
Post a Comment