From owner-freebsd-questions Tue Aug 6 5:35:43 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8EE8537B400 for ; Tue, 6 Aug 2002 05:35:38 -0700 (PDT) Received: from mta01.fuse.net (mx1.fuse.net [216.68.2.90]) by mx1.FreeBSD.org (Postfix) with ESMTP id E4E2243E84 for ; Tue, 6 Aug 2002 05:35:37 -0700 (PDT) (envelope-from p_gates@fuse.net) Received: from 0016716867 ([66.161.192.3]) by mta01.fuse.net (InterMail vM.5.01.03.01 201-253-122-118-101-20010319) with SMTP id <20020806123537.IBPI18154.mta01.fuse.net@0016716867> for ; Tue, 6 Aug 2002 08:35:37 -0400 Message-ID: <001501c23d48$50c93b20$5d7e880a@zoomtown.com> From: "Phil Gates" To: Subject: ksh scripting arguments Date: Tue, 6 Aug 2002 08:53:51 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0012_01C23D26.C9854080" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C23D26.C9854080 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi I am writing a ksh script and I am having a problem with a if = statement. when I run the script you need to put a argument on the = command line. So inside the script I try to make sure that a user is = putting a argument on the command line with a if command. The if = command is below: if [$1 -z ] then echo "you must put a argument on the command line." exit fi the if statement work fine if there no argument. it will print out the = echo statement. On the other handif I put a argument on the command = line it will print out the argument and say command is not found.=20 example of command line and statement $command argument print out to screen argument is not found I have done ksh scripting on a hp-us machine and I never had this = problem before. Has it something how the Unix machine is setup. It = seems like the machine does not like any thing that is not a command. It = does the same thing if I assign a variable. in the program. So the = program is fine if I do no error checking i.e unix command only , but if = I use any ksh scripting command it seems to work different. If anyone can help please email back Thanks ------=_NextPart_000_0012_01C23D26.C9854080 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
    Hi I am writing a = ksh script and=20 I am having a problem with a if statement.  when I run the script = you need=20 to put a argument on the command line.  So inside the script I try = to make=20 sure that a user is putting a argument on the command line with a if = command.=20   The if command is below:
if [$1 -z ]
then
echo "you must put a argument on the = command=20 line."
exit
fi
 
the if statement work fine if there no = argument. it=20 will print out the echo statement.  On the other handif I put a = argument on=20 the command line it will print out the argument and say command is not = found.=20
example of command line and = statement
$command argument
print out to screen
argument is not found
 
I have done ksh scripting on a hp-us = machine and I=20 never had this problem before.  Has it something how the Unix = machine is=20 setup.  It seems like the machine does not like any thing that is = not a=20 command. It does the same thing if I assign a variable. in the = program.  So=20 the program is fine if I do no error checking i.e unix command only , = but if I=20 use any ksh  scripting command it seems to work = different.
 
If anyone can help please email = back
 
Thanks
 
------=_NextPart_000_0012_01C23D26.C9854080-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message