[英]Alias for bash commands using profile
I need to set up an alias in my profile to chain some console commands together, I usually do 我需要在个人资料中设置别名,以将一些控制台命令链接在一起,通常
su root <return>
<password>
rnd(one more alias just for cd into a particular directory)
I want to set up an alias to do all these together, I am new to unix. 我想设置一个别名来一起完成所有这些工作,对于UNIX我还是陌生的。 Is there anyway to simulate a 'return' in shellscripts?
无论如何,有没有在shellscript中模拟“返回”?
Thanks 谢谢
This is typically accomplished by 这通常通过以下方式完成
alias vault='cd /dragonvault && sudo -u smaug /bin/tcsh'
or 要么
alias vault='cd /dragonvault && sudo login -l -f smaug'
If smaug
is some administrative account configured with the shell nologin
, only the first form will work. 如果
smaug
是配置有shell nologin
某些管理帐户,则仅第一种形式有效。 For any of these aliases to work, you need to install and configure sudo
adequately. 为了使这些别名中的任何一个起作用,您需要适当地安装和配置
sudo
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.