Explicitly stating a path to an executable will make the shell try to use that path to execute the executable.
If saying ./myscript and if myscript is not in the current directory, then you will get a "no such file or directory" error. This does not use the $PATH variable.
The $PATH should be a :-delimited list of directories (not files) in which the shell will search for executables when no path is specified on the command line. It is a potential security risk to add the current directory (.) to the PATH variable (see "Is it safe to add . to my PATH? How come?").
Another simple solution for when you just want to have access to a single executable outside of you ordinary $PATH is to use an alias:
alias myscript=/path/to/myscript
(this goes in your shell initialization file, probably .bashrc for bash).
You should specify the full absolute path to the executable in the alias.
$PATH, path to your script is missing a/at the beginning. – sebasth Sep 24 '17 at 13:08./xyz.shunless you’re in the directory wherexyz.shis located. – G-Man Says 'Reinstate Monica' Sep 24 '17 at 13:57