i add an alias in .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
could it be achieved, thanks!
i add an alias in .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
could it be achieved, thanks!
 
    
     
    
    Use a shell function instead. eg:
function sr () {
  sudo /etc/rc.d/"$1" restart
}
 
    
    I'm surprised nobody mentioned to use a function
function sr() { 
  sudo /etc/rc.d/"$@" restart 
}
 
    
    Use a function rather than an alias:
function sr() { sudo /etc/rc.d/$@ restart; }
 
    
    Aliases in bash do not accept parameters. However, you could define a function instead:
function sr() { sudo /etc/rc.d/$1 restart; }
