Xref: utzoo comp.unix.questions:7480 comp.unix.wizards:9184 Path: utzoo!dciem!nrcaer!scs!spl1!laidbak!att!pacbell!ames!amdcad!sun!pitstop!sundc!seismo!uunet!unh!jeff From: jeff@unh.UUCP (Jeffrey E. F. Friedl) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: Command line argument in Cshell script Message-ID: <534@unh.UUCP> Date: 4 Jun 88 15:02:42 GMT Article-I.D.: unh.534 References: <497@slb-sdr.UUCP> Organization: University of New Hampshire, Durham, NH Lines: 35 Summary: use quotes In article <497@slb-sdr.UUCP>, saito@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@unhh" ..!ucbvax!kentvax!jfriedl I hope I'm not around Jan 18, 2038 at 10:14:08PM (friedl@vsi is my brother, and I'm proud of it. He is too [even if he says no]).