I want to setup an alias alias open=xdg-open
this whould replace the normal linux open
command which in turn itself is a symlink to openvt
.
我想设置一个别名别名open = xdg-open这可以替换普通的linux open命令,而open命令本身就是openvt的符号链接。
I've running a debian wheezy installation with a bash shell. Does Anybody see there possible problems if I do so?
我正在使用bash shell运行debian wheezy安装。如果我这样做,有人看到可能有问题吗?
2 个解决方案
#1
6
Yes it is. Once you alias it, it's valid only for your user.
是的。一旦您使用别名,它仅对您的用户有效。
You cold also add it inside ~/.bashrc
, so it will be available only for your user and only for the current shell session (aliasing itself again every time you start a new session).
您也可以将其添加到〜/ .bashrc中,因此它仅适用于您的用户,并且仅适用于当前的shell会话(每次启动新会话时都会再次出现别名)。
In some distro, .bashrc
loads a file called .bash_aliases
for every session. You could also add your alias there.
在某些发行版中,.bashrc为每个会话加载一个名为.bash_aliases的文件。你也可以在那里添加你的别名。
#2
2
alias
is simply a text replacement for the original(like preprocessor in C).
别名只是原始文本的替换(如C中的预处理程序)。
It's valid only in the current shell where it was created it unless you add it to .rc
file or .profile
. Once you exit, the alias is no longer there and as such I don't see why it would cause any problem.
除非您将其添加到.rc文件或.profile,否则它仅在创建它的当前shell中有效。退出后,别名不再存在,因此我不明白为什么会导致任何问题。
#1
6
Yes it is. Once you alias it, it's valid only for your user.
是的。一旦您使用别名,它仅对您的用户有效。
You cold also add it inside ~/.bashrc
, so it will be available only for your user and only for the current shell session (aliasing itself again every time you start a new session).
您也可以将其添加到〜/ .bashrc中,因此它仅适用于您的用户,并且仅适用于当前的shell会话(每次启动新会话时都会再次出现别名)。
In some distro, .bashrc
loads a file called .bash_aliases
for every session. You could also add your alias there.
在某些发行版中,.bashrc为每个会话加载一个名为.bash_aliases的文件。你也可以在那里添加你的别名。
#2
2
alias
is simply a text replacement for the original(like preprocessor in C).
别名只是原始文本的替换(如C中的预处理程序)。
It's valid only in the current shell where it was created it unless you add it to .rc
file or .profile
. Once you exit, the alias is no longer there and as such I don't see why it would cause any problem.
除非您将其添加到.rc文件或.profile,否则它仅在创建它的当前shell中有效。退出后,别名不再存在,因此我不明白为什么会导致任何问题。