bash - Failing to run a file through its pathway in the Linux terminal -
hi trying run file typing down whole pathway of login.sh file because want run program automatically upon bootup of raspberry pi. pathway login.sh file is:
/home/pi/desktop/rpi_code/logger_v1_01/login.sh
so login.sh file following:
#!/usr/bin/expect spawn sudo openconnect vpn.ucr.edu/engineering expect -r "\[sudo] .*\: " { send "pw_for_my_linux\n" } expect "username:" { send "my_vpn_username\n" } expect "password:" { send "vpn_password\n" } spawn sudo python logger.py expect -r "\[sudo\] .*\: " { send "pw_for_my_linux\n" } interact`
this program works fine when run terminal under folder logger_v1_01. when run terminal under /home files pathway gives me following error:
python: can't open file 'logger.py':[errno 2] no such file or directory
anyone can explain why case? why can't open file exists?
when run python logger.py
you're using relative path logger.py
. if it's not in current directory won't found. either use absolute path , able run anywhere, or within script ensure it's local, doing cd
directory containing it.
Comments
Post a Comment