Rename command in doesn't rename in 2 step command for files with spacebar (mac terminal)

Viewed 77

I want to rename a file named "Hi Dude" to "Hi Bro".

If I run the following command in bash, it works.

mv Hi\ Dude Hi\ Bro

But when I execute following two commands:

arg="Hi\ Dude Hi\ Bro"
mv $arg

It is showing following error:

usage: mv [-f | -i | -n] [-v] source target
mv [-f | -i | -n] [-v] source ... directory

Any solution for this? I want to implement this for another bash script.

1 Answers
Related