🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #7256

What's wrong with this sh script ?

#7256
From: Jun Lu
Date: Mon, 25 Mar 1991 22:00
49 lines
2066 bytes
The following attached script can be executed by typing its file name(say
test.sh) w/ no problem. "sh -x test.sh" also works OK.  But if I try to
use the "at -s <time> test.sh", the problem arises.  I got the
output(mail) like this:

Your "at" job "7148" produced the following output:

gus ...  10:56pm  up 2 days,  5:05,  1 user,  load average: 5.82, 6.24, 6.34
OK
mace.cc ... /bin/sh: syntax error at line 28: `end of file' unexpected

Can you guru out there tell me what is wrong(sh problem, rsh problem at
problem, or my problem) ?  I'm running under Sun3/60(and Sparc) with
SunOS4.0.x.  Thanks in advance.

--------- script(devised to illustrate the problem) ---
#! /bin/sh
# NOTE: The intent of this script is NOT to test if the remote machine
# is died; rather it is used to  to illustrtate the problem
#
PATH=/usr/ucb/:/bin:/usr/bin; export PATH

# gus
USER=luj
HOST=gus
echo -n "$HOST ... "
if rsh -l $USER $HOST uptime 
then
    echo OK
else 
    echo died
fi

# mace
USER=on5
HOST=mace.cc
echo -n "$HOST ... "
if rsh -l $USER $HOST uptime
then
    echo OK
else 
    echo died
fi
--------------- end of the script --------------

-- Jun Lu                          Internet:luj@ecn.purdue.edu          --
-- Aeronautics & Astronautics      Bitnet:  luj%ecn.purdue.edu@purccvm  --
-- Purdue University               UUCP:    pur-ee!luj                  -- 
-- W. Lafayette, IN 47907          Phone:317-494-9410  Fax:317-494-0307 --
Technical Details
Message-ID: <2185@brchh104.bnr.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request
From: pur-ee!luj@gus16.ecn.purdue.edu (Jun Lu)
Newsgroups: comp.sys.sun
Subject: What's wrong with this sh script ?
Keywords: Miscellaneous
Message-ID: <2185@brchh104.bnr.ca>
Date: 25 Mar 91 22:00:00 GMT
Sender: news@brchh104.bnr.ca
Organization: Sun-Spots
Lines: 49
Approved: Sun-Spots@rice.edu
X-Original-Date: Sun, 24 Mar 1991 04:15:35 GMT
X-Sun-Spots-Digest: Volume 10, Issue 69, message 8
X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu