I have written small bash to automate my code
JavaScript
x
#!/bin/bash
jhome () {
cd /home/milenko/OCCAM2DMT_V3.0/cifort
}
./Occam2D start.txt
The exe file is Occam2d and input file is start.txt. When I run my script I got
JavaScript
bash a.sh
a.sh: line 6: ./Occam2D: No such file or directory
Why?
Advertisement
Answer
With @anubhava’s comment:
JavaScript
#!/bin/bash
jhome () {
cd /home/milenko/OCCAM2DMT_V3.0/cifort
}
# call your function to change directory
# and only if cd was successful run ./Occam2D
jhome && ./Occam2D start.txt