How to make an “alias” for a long path?
问题 I tried to make an "alias" for a path that I use often while shell scripting. I tried something, but it failed: myFold="~/Files/Scripts/Main" cd myFold bash: cd: myFold: No such file or directory How do I make it work ? However, cd ~/Files/Scripts/Main works. 回答1: Since it's an environment variable (alias has a different definition in bash ), you need to evaluate it with something like: cd "${myFold}" or: cp "${myFold}/someFile" /somewhere/else But I actually find it easier, if you just want