I am using a Linux terminal app, it works flawlessly but I think I am having a problem here, and I don't know if it's an app or a me-error
below is my test.sh, everything in #comment is what i get after each line is called/runs, but note that this would normally be 2 files i guess, just brought them together
#!/bin/bash
echo "this is a test"
# this is a test
ls
# code downloads
pwd
# /data/data/com.termux/files/home
ls code
# python
ls code/python
# scripts programs
ls code/python/scripts
# abc.py test.py
cd code/python/scripts
pwd
#/data/data/com.termux/files/home/code/python/scrips
ls
# abc.py test.py
python3 test.py
# hello world
cd
python3 code/python/scrips/abc.py
# python3: can't open file '/data/data/com.termux/files/home/code/python/scrips/abc.py': [Errno 2] No such file or directory
python3 code/python/scrips/test.py
# python3: can't open file '/data/data/com.termux/files/home/code/python/scrips/test.py': [Errno 2] No such file or directory
important to note is that if i run
python3 code/python/scrips/abc.py in home, it works though. this is all i could do with testing and trying stuff out myself, all you see above is me "debugging"
I've seen shell programming questions here before, so I think it's an ok question.
cdcommand, without any arguments, changes the current directory to your home directory.pwdandecho $HOMEafter that lastcd. They should be the same.cd(the one that is alone in its line) and your script will run fine.python3 code/python/scrips/abc.pywon't work without moving back to the original directory. Its more likely that/data/data/com.termux/files/homeisn't the home directory.env | grep PATHand see whether the path wherepython3exists is included. Are you actually running this script interactively or are you running it from something like cron? If you don't run it interactively you loose all path information and have to define the path inside the bash script.