Reputation: 69
I would like to be able to access some frequently used directories no matter where I am in the directory path. I know aliasing can help with this problem, so I've made a few that I've placed into .bashrc. Here are some examples:
alias 'Programming'="cd /mnt/e/Programming/"
alias 'InternetExplorer' = "cd /mnt/c/Internet Explorer/"
The first alias works, but the second does not.
Here are the following things that I've tried:
alias 'InternetExplorer'="cd '/mnt/c/Internet Explorer/'"
alias 'InternetExplorer'="cd "/mnt/c/Internet Explorer/""
alias 'InternetExplorer'="cd /mnt/c/'Internet Explorer'/"
alias 'InternetExplorer'="cd /mnt/c/"Internet Explorer"/"
alias 'InternetExplorer'="cd /mnt/c/Internet\ Explorer/"
Some of these solutions do work on the command line, but I'm guessing aliasing just reads in everything under quotations as string. Also, I can always write a function called "Internet Explorer", but conceptually, I feel like aliasing should be the solution. I appreciate any help.
Upvotes: 0
Views: 1135
Reputation: 295766
When in doubt, use a function instead:
InternetExplorer() { cd "/mnt/c/Internet Explorer"; }
Upvotes: 2
Reputation: 972
alias InternetExplorer="cd \"/mnt/c/Internet Explorer\""
On cygwin bash, I would use
alias InternetExplorer="cd \"$(cygpath -m '*pasted dir from File Manager*'\""
Upvotes: 2