I don't know why but when I go to change this file name with mv
command it comes up with the error stating not a directory
.
-bash-4.1# mv {{ THEME SANITIZED }}.hacks.css myomega.hacks.css
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI don't know why but when I go to change this file name with mv
command it comes up with the error stating not a directory
.
-bash-4.1# mv {{ THEME SANITIZED }}.hacks.css myomega.hacks.css
mv "{{ THEME SANITIZED }}.hacks.css" myomega.hacks.css
will work.
You need to tell the shell that you mean for the braces and spaces to be part of the file name, instead of being interpreted as shell syntax.
You can type file names containing special characters inside single quotes. This works for every character except the single quote itself. This is the easiest method in a script.
mv '{{ THEME SANITIZED }}.hacks.css' myomega.hacks.css
If you need a single quote inside a single-quoted string, you can use the four-character sequence '\''
.
mv 'It'\'s' wierd' this_is_weird
Alternatively, you can put a backslash before any character, which makes it lose its special meaning. It doesn't hurt to put a backslash before characters that have no special meaning, but it's of course extra unnecessary typing.
mv \{\{\ THEME\ SANITIZED\ \}\}.hacks.css myomega.hacks.css
If the file name comes from a variable, use double quotes around the variable expansion to preserve special characters (with a bare variable as in mv $source $destination
, some special characters in the value of the variable are expanded).
source='{{ THEME SANITIZED }}.hacks.css'
destination=myomega.hacks.css
mv "$source" "$destination"
On the command line, the easiest way to type such a file name is to rely on completion. You'll need to enter at least the first character, then press Tab.
mv \{
Tab
mv \{\{\ THEME\ SANITIZED\ \}\}.hacks.css
you can use double quotes to scape or scape with slash like for example:
using double quotes:
mv "{{ THEME SANITIZED }}.hacks.css" myomega.hacks.css
using slash:
mv \{\{\ THEME\ SANITIZED\ \}\}.hacks.css myomega.hacks.css
something cool that some people doesn't know how to remove ou rename a directory when it's start with dash you can you dash dash :D
exemple:
mkdir -directory_with_dash
rm -r -- -directory_with_dash