Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
I need to know if the connection fails to the remote host in a shell script. Which error codes etc should I check for? What would be in the if statement? example, I use: ftp -n -i <<-EXIT open $REMOTE_HOST if ??????????
Name: stefan caunter Date: July 17, 2001 at 19:44:47 Pacific
Reply:
what you need to do is test for the exit status of the ftp command in a subshell first set a variable to be the exit status of ftp -n -i; if it is 0 everything is ok, if it is greater than 0, problem. soooo....
$var=`(ftp -n -i $REMOTE_HOST; echo $?)` if [$var -eq 0] ; then user xxxxx pass xxxxx elif [$var -gt 0] ; then echo "Could not connect to $REMOTE_HOST"
Summary: How do i skip the user login when i try to do a ftp in shell script? if i do the ftp at the command prompt, i will hit on the carriage return when the login is prompted. a normal ftp script would loo...
Summary: Hi, I'm trying to run loops in shell scripts using the following script. loop=1 while [ loop -lt 10 ] do echo 'this is my $loop text-line' loop='expr $loop + 1' done ---- but I'm getting error: test: ...
Summary: In shell script sed or awk command, can I use hexadecimal code for substitution? I want to perform the following: Input file: Line1 Line2 Line3 Line4 Output file: (all in one line now) Line1Line2Line...