Linux Shell script alias command

#!/bin/bash

echo  "如果alias是在~/.bashrc等文件中定义,需要先执行 source ~/.bashrc"
source /root/.bashrc
 
echo "检查是否默认情况下shell脚本中是否开启alias扩展"
shopt expand_aliases  
 
echo "默认情况下执行定义的alias"
aliasTest
 
echo "shell中开启alias扩展"
shopt -s  expand_aliases 
 
echo "shell中开启alias扩展之后检查"
shopt expand_aliases  
 
echo "shell中开启alias扩展之后,使用alias别名"
aliasTest

Structured video platform startup script, for example, the following script

#########################################################################
# File Name: start.sh
# Author: linuxidc
# mail: [email protected]
# Created Time: Thu Aug  1 13:42:16 2019
#########################################################################
#!/bin/bash
source ~/.bashrc
shopt -s  expand_aliases
deploy all start
operation all start
Published 15 original articles · won praise 0 · Views 286

Guess you like

Origin blog.csdn.net/weixin_44478009/article/details/103868923