I’m glad you found the solution.
This lesson is important any time you are using a shell script!!
By way of making it a little easier to comprehend why this is necessary, look no further than the other part of your command:
Note that you had use
\ to “escape” the space there. If
$1 has a space in it, there is no
\ so the command will fail.
You could also have used single or double quotes around your folder name, to avoid having to “escape” the space:
(I tend to prefer to use quotes instead of
\ because I find it easier to read, but to each their own.)
Since I’ve already gone this far, I might as well mention that you can use
$HOME instead of
/Users/me and then you could share it with someone else whose username is not
me or if you have another Mac where you have a different username.
However, as you mentioned, if you use
$HOME then you must use double quotes instead of single:
"$HOME/Desktop/Transfer/remove encryption" will work, because the variable
$HOME will be “expanded”.
'$HOME/Desktop/Transfer/remove encryption' will NOT because
$HOME will be interpreted literally.