aline.ba - 10 months ago 65
Linux Question

# Launch Bash script with command line and full path

I launch bash scripts normally with the ./ command.

But if I try to launch the script with the full path I get an error

No such file or directory

I am so confused, I made a search to be sure to get the right path.

$pwd /home/pi/server/$ ls
start_scan

$sudo chmod 777 start_scan$ sudo find / -xdev -name start_scan
/home/pi/server/start_scan

\$ ./home/pi/server/start_scan
-bash: ./home/pi/server/start_scan: No such file or directory


Do you have any idea what could the problem be? I am using a macbook to use SSH and connect to a Rapsberry Pi under Raspbian and execute the script there.

./ is no command, but a path that means the current working directory.

Your line is almost correct, just remove the dot at the beginning:

/home/pi/server/start_scan


When you type any path starting with a dot, the shell expands it to the current working directory, effectively searching in

/home/pi/server/home/pi/server/start_scan


which is obviously wrong.