command line argument in Cshell scripts

greim at sbsvax.UUCP greim at sbsvax.UUCP
Wed Jun 8 23:04:10 AEST 1988


In <497 at slb-sdr.UUCP: Naoki Saito writes :

:	Hello, I wrote a C-shell script to automate the task as follows:
:=======================================================================
:#
:# Shell script for the plot3d for field files.
:#
:# Usage: p3d <filename> [parameters for plot3d]
:#
:
:set TEMP=/tmp/z
:if (-e $TEMP) 	\rm $TEMP
:
:chkf -b -d $argv[1] > $TEMP
:plot3d z=$TEMP -P $argv[2-] | sunplot
:	
:if (-e $TEMP) 	\rm $TEMP
:
:exit
:=======================================================================
:
:	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
:
:This means that in the case of (1) $argv[2] is considered as tl="This_is_wrong"
:but in (2) $argv[2] becomes tl="This.
:	How can I pass the space containing arguments? Does anybody out there
:have solution for this?
:
Try
	plot3d z=$TEMP -P "$argv[2-]" | sunplot

The manual csh(1) says under heading "command substitution" :

	Within `"`s, only newlines force new words; blanks and tabs
	are preserved.


		Michael



More information about the Comp.unix.wizards mailing list