Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Not to Escape Backslash in script

Shell Programming and Scripting


Tags
avoid backslashes, user command

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-10-2017
Thala Thala is offline
Registered User
 
Join Date: Dec 2013
Last Activity: 9 June 2017, 5:07 PM EDT
Posts: 46
Thanks: 15
Thanked 1 Time in 1 Post
Not to Escape Backslash in script

Hello Folks,
I am looking for a bash script which check the ftp server connection status and transfer success/failure also final stage is like if the transfer/connection failed, i should get an email.

First stage - checking for login success or not




Code:
#!/bin/bash
HOST='your.ftp.site'
USER=apac\remoteusername'
PASSWD='remotepasswd'

ftp -n -v $HOST << EOT
ascii
user $USER $PASSWD
prompt
cd upload
ls -la
bye
EOT


But this escapes the '\' in $USER and consider it as apacremoteusername


Kindly help me how to accept '\' for user command? Or any other command which accepts '\'


Thanks in Advance
Sponsored Links
    #2  
Old Unix and Linux 05-10-2017
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 22 October 2017, 3:27 AM EDT
Location: Aachen, Germany
Posts: 11,481
Thanks: 310
Thanked 3,561 Times in 3,276 Posts
Did you consider trying \\ ?
The Following User Says Thank You to RudiC For This Useful Post:
Thala (05-18-2017)
Sponsored Links
    #3  
Old Unix and Linux 05-10-2017
MadeInGermany MadeInGermany is offline Forum Staff  
Moderator
 
Join Date: May 2012
Last Activity: 22 October 2017, 8:39 AM EDT
Location: Simplicity
Posts: 3,781
Thanks: 311
Thanked 1,267 Times in 1,146 Posts
Do you have

Code:
USER='apac\remoteusername'

i.e. ticks around the string?
    #4  
Old Unix and Linux 05-18-2017
Thala Thala is offline
Registered User
 
Join Date: Dec 2013
Last Activity: 9 June 2017, 5:07 PM EDT
Posts: 46
Thanks: 15
Thanked 1 Time in 1 Post
\\ worked in .netrc file!
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Auto escape script to escape special chars in script args LMHmedchem Shell Programming and Scripting 1 09-18-2013 02:08 PM
How to print backslash in shell script using awk? wxuyec Shell Programming and Scripting 8 01-30-2013 03:37 PM
SED script to backslash special characters skylersee Shell Programming and Scripting 5 05-26-2010 07:51 AM
Problem in expect script with password involving trailing backslash pradeeptyagi23 Shell Programming and Scripting 4 06-20-2009 04:27 AM
Shell Script -- problem reading backslash(\)!! rossi143 Shell Programming and Scripting 2 04-04-2007 02:52 AM



All times are GMT -4. The time now is 11:39 AM.