我在.bashrc中添加了一个别名
alias sr ='sudo /etc/rc.d/[parameter?] restart'
sr network - > sudo /etc/rc.d/network restart
sr sshd - > sudo /etc/rc.d/sshd restart
可以实现,谢谢!
Lau*_*ves 13
请改用shell函数.例如:
function sr () {
sudo /etc/rc.d/"$1" restart
}
Run Code Online (Sandbox Code Playgroud)