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

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-10-2017   -   Original Discussion by Thala
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   -   Original Discussion by Thala
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 19 November 2017, 9:29 AM EST
Location: Aachen, Germany
Posts: 11,625
Thanks: 320
Thanked 3,617 Times in 3,322 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   -   Original Discussion by Thala
MadeInGermany MadeInGermany is offline Forum Staff  
Moderator
 
Join Date: May 2012
Last Activity: 19 November 2017, 9:36 PM EST
Location: Simplicity
Posts: 3,824
Thanks: 318
Thanked 1,281 Times in 1,159 Posts
Do you have

Code:
USER='apac\remoteusername'

i.e. ticks around the string?
    #4  
Old Unix and Linux 05-18-2017   -   Original Discussion by Thala
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
Closed

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 03:08 PM
How to print backslash in shell script using awk? wxuyec Shell Programming and Scripting 8 01-30-2013 04:37 PM
SED script to backslash special characters skylersee Shell Programming and Scripting 5 05-26-2010 08:51 AM
Problem in expect script with password involving trailing backslash pradeeptyagi23 Shell Programming and Scripting 4 06-20-2009 05:27 AM
Shell Script -- problem reading backslash(\)!! rossi143 Shell Programming and Scripting 2 04-04-2007 03:52 AM



All times are GMT -4. The time now is 03:33 AM.