简体   繁体   中英

~/.bashrc alias to change directory not working

This is possibly a boring question, but I could not find an answer that I completely understood for the following query.

I moved to a new research institute and I am accessing virtual machines for my research. I want to create a handy bashrc to make life easier.

So, editing the ~/.bashrc file with the following:

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/"

and opening a new terminal to use the updated bashrc file I get the following errors:

-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

I do not understand what is going wrong. Could you explain this to me, please, and if possible, provide a fix? Much obliged.

Bash variable declaration does not allow space before and after =

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/"

Refer this link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM