I made a text file called hello world
in my home directory. Via the shell I am trying to remove it with the rm
command. However, when I execute rm hello world
the shell thinks that I am trying to delete two separate files, one called "hello" and the other called "world." How do I go about doing this correctly?
You can quote it:
rm "hello world"
or escape the space:
rm hello\ world
-
-
The shell works with "tokens" that are usually whitespace delimited. Quotes (either single or double) creates a token that starts with the character following the beginning quote and ends with the character preceding the end quote. Like @josten mentioned, make the shell pass a single token containing "hello world" instead of two tokens containing "hello" and "world". – Andy Dalton Sep 1 '15 at 21:29