gnome-terminal带有别名作为命令执行的新选项卡 [英] gnome-terminal new tab with alias as command to execute

查看:154
本文介绍了gnome-terminal带有别名作为命令执行的新选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在.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 aliases.

现在您的想法行不通了,因为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆