gnome-terminal带有别名作为命令执行的新选项卡 [英] gnome-terminal new tab with alias as command to execute
问题描述
我已经在.bashrc
文件中创建了别名,如下所示:
I've created an alias in .bashrc
file as follows
alias myproject = 'cd ~/Desktop/myproject'
在重新启动终端后保存文件后,键入myproject
会将我带到项目目录,但是当我尝试将别名用作新的gnome-terminal
选项卡的命令参数时,会抛出错误,>
After saving the file when I restart my terminal, typing in myproject
takes me to the project directory but when I try to use the alias as a command argument to a new gnome-terminal
tab it throws an error,
gnome-terminal --tab -e "myproject"
引发错误
There was an error creating the child process for this terminal
Failed to execute child process "myproject" (No such file or directory)
这有什么问题?
推荐答案
启动bash shell时,默认情况下bash
执行.bashrc
中指定的命令.这就是您的Shell知道您的alias
es的方式.
When a bash shell is started, per default bash
executes the commands specified in .bashrc
. This is how your shell knows your alias
es.
现在您的想法行不通了,因为gnome-terminal
从未看到您的.bashrc
文件.
Now your idea does not work because gnome-terminal
never sees your .bashrc
file.
您可以尝试
gnome-terminal --working-directory='<path-to-your-home-directory>/Desktop/myproject/
这篇关于gnome-terminal带有别名作为命令执行的新选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!