Command line argument in Cshell script

Jeffrey E. F. Friedl jeff at unh.UUCP
Sun Jun 5 01:02:42 AEST 1988


In article <497 at slb-sdr.UUCP>, saito at slb-sdr.UUCP (Naoki Saito) writes:
> 
> 	Hello, I wrote a C-shell script to automate the task as follows:
> =======================================================================
> #
  [start of program]
> plot3d z=$TEMP -P $argv[2-] | sunplot
  [rest of program]
> 
> 	This works fine unless I use command line arguments of strings which
> contain space, e.g.,
> (1) p3d fname tl="This_is_wrong" ---> OK
> (2) p3d fname tl="This is wrong" ---> Failed
> 

Put quotes such as:
original:	plot3d z=$TEMP -P  $argv[2-]  | sunplot
working:	plot3d z=$TEMP -P "$argv[2-]" | sunplot

Thus, when $argv[2] is expanded, it is expanded within quotes and is considered
one arg to plot3d.

Also, to load faster, have the first line be
#/bin/csh -f

However, most shell scripts should be written in [k]?sh............

	*jeff*
-------------------------------------------------------------------------------
Jeffrey Eric Francis Friedl, Box 2146 Babcock House, Durham New Hampshire 03824
..!{uunet,decvax}!unh!jeff   BITNET%"j_friedl at unhh"  ..!ucbvax!kentvax!jfriedl

I hope I'm not around Jan 18, 2038 at 10:14:08PM

(friedl at vsi is my brother, and I'm proud of it. He is too [even if he says no]).



More information about the Comp.unix.questions mailing list