The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Back-to-Back Connection using HBAs aldowsary IP Networking 3 11-28-2008 10:21 PM
Help with SED and forward slash gseyforth Shell Programming and Scripting 3 05-26-2008 07:29 AM
back to back printing in UNIX amirthraj_12 AIX 3 05-06-2008 07:42 AM
ftp username with back slash sam99 Shell Programming and Scripting 1 04-29-2008 09:19 AM
awk slash McLan Shell Programming and Scripting 6 04-09-2008 02:00 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-18-2008
Arunprasad Arunprasad is offline
Registered User
  
 

Join Date: Aug 2008
Location: syn chen
Posts: 70
Post About \ (Back slash)

Hi All,

print "path/executable_file parameters" \
> path/file1
print "path/executable_file parameters" \
> path/file2
print "path/executable_file parameters" \
> path/file3


chmod 775 path/file1 \
path/file2 \
path/file3

could you please let me know how the back slash will be useful and its effect in using in the shell script.
please explain how its working in the above print and chmod.

i read some documents about back slash
"preceding the same string with a backslash, \, also removes the special meaning of a character, or string".

i am not getting what it is actually doing.
please let me know.

Thanks.
  #2 (permalink)  
Old 11-18-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,546
print "path/executable_file parameters" \
> path/file1
=
print "path/executable_file parameters" > path/file1

Nothing more...
(Someone supposed the line was too long...)
  #3 (permalink)  
Old 11-18-2008
Arunprasad Arunprasad is offline
Registered User
  
 

Join Date: Aug 2008
Location: syn chen
Posts: 70
Hi vbe,

Thanks for your update.

i read some documents about back slash, i am not clear with the below statement
"preceding the same string with a backslash, \, also removes the special meaning of a character, or string".

what it means.
  #4 (permalink)  
Old 11-18-2008
demwz demwz is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 128
There are some special characters in Unix for ex :" $ & \ ~"
putting a \ before a special character inverts the special meaning of a character. so it is getting a simple ascii text
Code:
sptmw@mwvm:~$ echo ~
/home/sptmw
sptmw@mwvm:~$ echo \~
~
also the are simple ascii letters which can be turned to special characters by putting a \ in front
echo \b hello
in some terminals causes bold text

and one line \[ENTER]
second line

means ignore the [ENTER] Key an handle everything as one line
  #5 (permalink)  
Old 11-18-2008
zouhair zouhair is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 12
If you have a file named "this$file" (the $ is part of the name), and you want to handle it with a shell you have to remove its special meaning for the shell (it is used to exctract variable data for example) by preceding it by a \

Code:
pobo@intrepid /tmp $
 touch 'this$file'

pobo@intrepid /tmp $
 ls thi*
this$file

pobo@intrepid /tmp $
 rm this$file
rm: cannot remove `this': No such file or directory

pobo@intrepid /tmp $
 rm this\$file
rm: remove regular empty file `this$file'? y

pobo@intrepid /tmp $
  #6 (permalink)  
Old 11-18-2008
Arunprasad Arunprasad is offline
Registered User
  
 

Join Date: Aug 2008
Location: syn chen
Posts: 70
Thanks demwz,

as per my question its effect is to use the big lines in seperate lines for script readness the same while processing it is considered as single line.

correct me if i am wrong.
  #7 (permalink)  
Old 11-18-2008
demwz demwz is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 128
yes you're right
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 03:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0