美文网首页
Enable 'alias' and 'source' in .

Enable 'alias' and 'source' in .

作者: cutelittlePanda | 来源:发表于2018-04-09 20:01 被阅读0次

    1. Enable 'alias' to be executable in shell script: 1).exe 'shopt -s expand_aliases' in .sh, and; 2). using 'source shell_name.sh' to execute shell script;  or else, if using './shell_name.sh', the 'alias' command in script will not be executed, cause shell will not invoke another process for it while will for 'date' and others.

    2. Enable 'source' to executable in shell scripts: #!/bin/sh  ===change to===> #!/bin/bash

               ### comment 'exit 0' in the last line of script, or else the windows will be disappeared(EXITED).

    3. sh script.sh === ./script.sh   (#!/bin/sh) ;  source script.sh === . script.sh  (#!/bin/bash)

    相关文章

      网友评论

          本文标题:Enable 'alias' and 'source' in .

          本文链接:https://www.haomeiwen.com/subject/cdkshftx.html