linux - 使用别名作为要执行的命令的 gnome 终端新选项卡

标签 linux alias gnome-terminal

我在 .bashrc 文件中创建了一个别名,如下所示

alias myproject = 'cd ~/Desktop/myproject'

在我重新启动终端时保存文件后,输入 myproject 会将我带到项目目录,但是当我尝试使用别名作为新 gnome-terminal 的命令参数时 选项卡它抛出一个错误,

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.

现在你的想法行不通了因为gnome-terminal永远不会看到你的 .bashrc文件。

你可以试试

gnome-terminal --working-directory='<path-to-your-home-directory>/Desktop/myproject/

关于linux - 使用别名作为要执行的命令的 gnome 终端新选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17402152/

相关文章:

linux - 在 solaris 和 linux 中构建 ace 时出错

linux - Beaglebone 黑色视频捕获 : Error "select timeout"

php - 使用 php 或 avconv 获取 .mov 视频旋转

linux - 用于打开终端并 cd 到变量目录的 Bash 脚本

linux - 多人项目上的 SVN 补丁/差异管理

c++ - C++11 中的 const 类型到 const 别名

bash 函数保留制表符补全

macos - 如何在 Sublime Text 3 中使用 Mac 操作系统别名?

linux - 重命名当前 gnome 终端的别名

linux - 在 linux 终端中如何使用 gnome-terminal 打开 ssh session 并在 ssh session 中键入 bash 命令