gpt4 book ai didi

alias - ~/.bashrc 别名更改目录不起作用

转载 作者:行者123 更新时间:2023-12-02 21:00:42 26 4
gpt4 key购买 nike

这可能是一个无聊的问题,但我无法找到我完全理解以下查询的答案。

我搬到了一个新的研究所,我正在访问虚拟机进行研究。我想创建一个方便的 bashrc 让生活更轻松。

因此,使用以下内容编辑 ~/.bashrc 文件:

alias lhcb = "cd ~/vols/lhcb/bd1316/B2ppKgamma/"
alias work_space = "cd ~/home/hep/bd1316/Public/Project/"
alias Code = "cd ~/home/hep/bd1316/Public/Project/Scripts/"

并打开一个新终端来使用更新后的 bashrc 文件,我收到以下错误:

-bash: alias: alias: not found
-bash: alias: =: not found
-bash: alias: cd ~/vols/lhcb/bd1316/B2ppKgamma/: not found
-bash: alias: work_space: not found
-bash: alias: =: not found
-bash: alias: cd ~/home/hep/bd1316/Public/Project/: not found
-bash: alias: Code: not found
-bash: alias: =: not found
-bash: alias: cd ~/home/hep/bd1316/Public/Project/Scripts/: not found

我不明白出了什么问题。您能给我解释一下吗?如果可能的话,请提供修复程序吗?非常感谢。

最佳答案

Bash 变量声明=前后不允许有空格

alias lhcb="cd ~/vols/lhcb/bd1316/B2ppKgamma/"
alias work_space="cd ~/home/hep/bd1316/Public/Project/"
alias Code="cd ~/home/hep/bd1316/Public/Project/Scripts/"

引用this链接。

关于alias - ~/.bashrc 别名更改目录不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38392787/

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