How to make an “alias” for a long path?

前端 未结 10 1943
广开言路
广开言路 2020-12-22 17:58

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
         


        
10条回答
  •  滥情空心
    2020-12-22 18:31

    Another option would be to use a symbolic link. ie:

    ln -s ~/Files/Scripts/Main ~/myFold
    

    After that you can perform operations to ~/myFold, such as:

    cp some_file.txt ~/myFold
    

    which will put the file in ~/Files/Scripts/Main. You can remove the symbolic link at any time with rm ~/myFold, which will keep the original directory.

提交回复
热议问题