Skip to content
Advertisement

Linux shell change directory,file not found

I have written my convert.sh shell

#!/bin/bash

alias proj="cd /home/milenko/MT8/meas_2015-06-29_19-18-28"

tsmp -nspw -wl 512 -rect -back -trf theo -run 99  263_V01_C05_R000_TEx_BH_131072H.ats 
tsmp -nspw -wl 512 -rect -back -trf theo -run 99  263_V01_C06_R000_TEy_BH_131072H.ats

This is my working directory

milenko@host:~/ProcMT64/old/version_september_2015/bin$ pwd
/home/milenko/ProcMT64/old/version_september_2015/bin

All executables and libraries are here, including tsmp.

ls -l tsmp
-rwxrwxr-x 1 milenko milenko 835143 Set 11 13:48 tsmp

But when I run my script

milenko@host:~/ProcMT64/old/version_september_2015/bin$ sh convert.sh
convert.sh: 5: convert.sh: tsmp: not found
convert.sh: 6: convert.sh: tsmp: not found

It seems that I do not understand alias. Following chepner’s comments,I have tried this

(cd /home/milenko/MT8/meas_2015-06-29_19-18-28 &&  ./tsmp -nspw -wl 512 -rect -back -trf theo -run 98)

But

c1.sh: line 3: ./tsmp: No such file or directory

Why?

Advertisement

Answer

tsmp is not in your PATH environment variable, so you have to be explicit about where it is:

#!/bin/bash

alias proj="cd /home/milenko/MT8/meas_2015-06-29_19-18-28"

./tsmp -nspw -wl 512 -rect -back -trf theo -run 99  263_V01_C05_R000_TEx_BH_131072H.ats 
./tsmp -nspw -wl 512 -rect -back -trf theo -run 99  263_V01_C06_R000_TEy_BH_131072H.ats
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement