For example, if I want to rename the file old_name new_name, I can use the following code:
args='old_name new_name'
mv $args
However, if the original filename is old name, neither of the following code is able to work as intended:
args='"old name" new_name'
mv $args
# mv: target 'new_name' is not a directory
args='old\ name new_name'
mv $args
# mv: target 'new_name' is not a directory
new_name is recognized as the third arguments. It seems that characters like " and \ lose their special meanings after expanded from a string.
How to properly pass a string with blanks as separate command line arguments? In this case, is there a way to specify that old and name should be grouped together?
Thanks!