LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-21-2011, 04:19 AM   #1
kurtcpp
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Rep: Reputation: 0
backslash preceding a shell command


Hi everyone,
Reading a BASH script, I saw a find command preceded with a backslash.
It was similar to this:
Code:
`\find . -type f -name '*.xml' -print > xmlfilelist`
Please, can someone explain me the point of the backslash here?
It's impossible to find documentation about this in man pages or on the internet, since 'backslash' are always evoked along with special characters.
I also noticed that even though the command was surrounded with backquotes, the result was not affected to any variable.
Maybe the backslash's presence is related with this?

Thanks to all for your help!
Cheers!

Kurt
 
Old 03-21-2011, 04:33 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Hi and welcome to LinuxQuestions!

A command preceded by backslash is executed as is, for example aliases are not in effect. You can easily verify this using the ls command, which normally is aliased to something like 'ls --color=tty':
Code:
\ls
Edit: this behaviour is mentioned here. Strangely, I cannot find any reference in the Advanced Bash Scripting Guide or in the Bash Reference Manual, but maybe it's hidden among the lines. Anyway, it's not shell specific: I used it on SUN OS machines with /bin/tcsh as default shell.

Last edited by colucix; 03-21-2011 at 04:44 AM.
 
Old 03-22-2011, 04:05 AM   #3
kurtcpp
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Hi Colucix!
Thanks a lot for your answer!!
That question had been gnawing at me for weeks now!
Cheers!

Kurt
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sed command to replace slash with backslash stelmed Slackware 13 08-19-2010 05:01 AM
The sed bash command, not print backslash in Perl azkarashare Programming 8 07-12-2010 06:58 AM
converting Dos link backslash to Unix like backslash barunparichha Linux - Software 1 05-14-2009 09:54 AM
Apache directory preceding domain in url MasterC Linux - Networking 9 03-14-2005 06:32 AM
Removing a preceding pattern from each sentence ganninu Programming 2 12-11-2003 07:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration