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)
网友评论