“Command not found” inside shell script

后端 未结 2 1369
小鲜肉
小鲜肉 2021-01-23 22:15

I have a shell script on a mac (OSX 10.9) named msii810161816_TMP_CMD with the following content.

matlab

When I execute it, I get



        
2条回答
  •  无人共我
    2021-01-23 22:54

    By default, aliases are not expanded in non-interactive shells, which is what shell scripts are. Aliases are intended to be used by a person at the keyboard as a typing aid.

    If your goal is to not have to type the full path to matlab, instead of creating an alias you should modify your $PATH. Add /Applications/MATLAB_R2014a.app/bin to your $PATH environment variable and then both you and your shell scripts will be able to simply say

    matlab
    

提交回复
热议问题