gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 01:27:06 24 4
gpt4 key购买 nike

我在 .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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com