0

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 1

0

Did you try to quote the variable?

cd "$myfiles"
3
  • 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
  • 1
    I 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' or echo '$HOME' vs echo "$HOME" Apr 29, 2023 at 19:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .