PDA

View Full Version : meaning of "\" in "\mkdir ..."


flylehe
February 26th, 2009, 05:05 PM
Hi,
In a bash shell script, what does "\" mean in "\mkdir ...". or more generally in "\command"? "\" here seems not treating the following charaters literally, but instead executes the command. So what does it make a difference than not using "\"? Thanks!

snova
February 26th, 2009, 05:42 PM
Doesn't expand aliases. For example, in an uncustomized Bash session:


$ alias ll='ls -l'
$ ll
# Works as expected ...
$ \ll
bash: ll: command not found

flylehe
February 26th, 2009, 06:41 PM
Thank you!

So in my case, mkdir could have been defined as alias of other command? And using "\mkdir" will ensure the bash command mkdir will be executed?

I searched the whole script, no mkdir appeared before the use of "\mkdir" and "\mkdir" is its only appearance. So what could the purpose of "\mkdir" possibly be?

Thanks!

simeon87
February 26th, 2009, 06:44 PM
Thank you!

So in my case, mkdir could have been defined as alias of other command? And using "\mkdir" will ensure the bash command mkdir will be executed?

I searched the whole script, no mkdir appeared before the use of "\mkdir" and "\mkdir" is its only appearance. So what could the purpose of "\mkdir" possibly be?

Thanks!

I think you answered your own question.. it prevents an alias mkdir instead of the command mkdir to be executed.