Mud*_*Ali 5 linux alias gnome-terminal
我在.bashrc文件中创建了一个别名,如下所示
alias myproject = 'cd ~/Desktop/myproject'
Run Code Online (Sandbox Code Playgroud)
重新启动终端后保存文件后,键入myproject将我带到项目目录,但是当我尝试将别名用作新gnome-terminal选项卡的命令参数时,它将引发错误,
gnome-terminal --tab -e "myproject"
Run Code Online (Sandbox Code Playgroud)
引发错误
There was an error creating the child process for this terminal
Failed to execute child process "myproject" (No such file or directory)
Run Code Online (Sandbox Code Playgroud)
这有什么问题?
当 bash shell 启动时,默认bash执行 .bashrc 中指定的命令.bashrc。这就是你的 shell 知道你的aliases 的方式。
现在你的想法行不通了,因为gnome-terminal从来没有看到你的.bashrc文件。
你可以尝试
gnome-terminal --working-directory='<path-to-your-home-directory>/Desktop/myproject/