From the command line, I can get to My Documents by "cd /cygdrive/c/Documents\ and\ Settings/myusername/My\ Documents". The space in the file name must be preceded by a backslash. However when I define an alias (myfiles) in my .bashrc file, source the .bashrc file and then type "cd $myfiles", cygwin says "too many arguments". What am I doing wrong?
1 Answer
Did you try to quote the variable?
cd "$myfiles"
-
No, I had not tried using cd "$myfiles" but it works like a champ. Thanks ever so much for the suggestion. Aug 21, 2017 at 19:21
-
1I just discovered that single quotes around $myfiles will not work; you have to use double quotes. Apr 29, 2023 at 17:21
-
@BenBlackwell I think shells usually dont interpolate variables in single quotes. Try
echo '$myfiles'
orecho '$HOME'
vsecho "$HOME"
Apr 29, 2023 at 19:06