It is currently Tue, 30 Nov 2021 18:38:31 GMT



 
Author Message
 A Simple Bourne Shell Script ?
In article <36hcj5$...@news.ecn.bgu.edu>,

---snip!
% cat >bleah
#!/bin/sh
echo $# $1 $2 $3 $4
^D
% chmod 700 bleah
% ./bleah asdf fdsa etc
3 asdf fdsa etc
% ./bleah once twice three times a lady
6 once twice three times
%
---snip!

...a bit cryptic, but the best things are worth figuring out.
If all else fails, try this:

---snip!
% man sh
---snip!
It works wonders, but you know that already because obviously you've tried
it first.  You must have a cruel and demented sysadmin for not giving you
access to the Bourne Shell manuals this way.  I reccomend you beat her up
with Nerf cricket bats.
--
Moses Moore: net.surfer, neophyte sysadmin, publisher and storyteller.
 'finger jajmo...@csclub.uwaterloo.ca | grep <subject>' for Internet Services.
GCS(T) d- H+++ s:+ g- p0 !au a- w+ v++(-) C++$ UUS++++$   /#include <quote.h>    P+>++ L>+ !3 E--- N++ K++ W++(--) M- !V po* Y t+ 5- !j  /#define GIRLFRIEND     R(+) G+ tv b+ D++ B--- e+ u+(-) h-- f++ r++ n* y++     /#include<disclaim.h>
<a href=" http://www.**-**.com/ ;>LARG*net homepage</a> is what I maintain.



 Wed, 19 Mar 1997 04:24:27 GMT   
 A Simple Bourne Shell Script ?
In article <36hcj5$...@news.ecn.bgu.edu>,
$#

man sh

--
Bill Marcum  bmar...@iglou.com
Disclaimer:  Opinions expressed are bla bla bla, yackety smackety.



 Wed, 19 Mar 1997 08:28:48 GMT   
 A Simple Bourne Shell Script ?
How do you test for the existence of multiple command-line arguments passed
to a shell script?  Also, how can you count the # of arguments?

Thanks for your help!



 Tue, 18 Mar 1997 23:58:29 GMT   
 A Simple Bourne Shell Script ?
: How do you test for the existence of multiple command-line arguments passed
: to a shell script?  Also, how can you count the # of arguments?

The number of argument is in the variable $#
Below is a shell fragment to see if at least one argument is present.
If not, it prints the Usage message and exits.

if test $# -lt 1
then
echo Usage: Not enough arguments
exit
fi

change the number to suite your program.

--
INTERNET:  r...@Celestial.COM   Ray A. Jones; Celestial Software
           8545 SE 68 St.,  Mercer Island, WA 98040; (206) 236-1676
The probability of one or more spelling errors in this missive approaches
unity.  If this bothers you, run it through your spell checker!



 Thu, 20 Mar 1997 07:29:49 GMT   
 
   [ 4 post ] 

Similar Threads

1. Simple Bourne Shell script question

2. Simple Bourne Shell Scripts...

3. SIMPLE BOURNE SHELL SCRIPTING...

4. A Solaris 8 (Bourne Shell) Scripting question, regarding a log rotation script

5. help in learning how to do Bourne shell scripts then converting them to csh scripts


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software