Path: utzoo!attcan!lsuc!maccs!fred From: fred@maccs.dcss.mcmaster.ca (Fred Whiteside) Newsgroups: comp.unix.shell Subject: bourne shell query Message-ID: <26DC6447.15922@maccs.dcss.mcmaster.ca> Date: 30 Aug 90 00:56:38 GMT Reply-To: fred@maccs.dcss.mcmaster.ca (Fred Whiteside) Organization: Chedoke-McMaster Hospitals, Hamilton, Canada Lines: 31 i have a simple little shell question. I am attempting to write a script that will perform various manipulations on news articles. my problem seems to be with understanding variable substitution in sh. a minimal example is the enclosed sh script. what it should do is set the variable files to be the names of those articles in comp.std.c whose name (article number) is greater than or equal to the numeric value of the scripts first argument. this does not behave as expected. i have tried quite a unmber of variations on this theme (mostly centering around multiple $'s and interesting quoting of commands, but i tend to get all of the files or none of them depending on (for some reason) the number of $'s preceding the zots variable name (also on the number in front of the 1, $1 or $$1, etc. but i expected that ...) this is running under sunos4.1 if that is interesting. i have tried to read the manual, but with little success. anyone interested in pointing out my clear stupidity publicly? i *would* appreciate it .... many thanks ... #!/bin/sh cd /usr/spool/news/comp/std/c zots=$1 echo "Should ignore files with name < $zots" files=`ls -rt * |grep -v '.*[a-zA-Z].*' | awk $1 '>=' $zots {print}` echo $files -- Fred Whiteside Chedoke-McMaster Hospitals, Hamilton, Ontario, Canada whitesid@{mcmaster.ca,darwin.cmh.mcmaster.ca,130.113.2.18} fred@maccs.DCSS.McMaster.CA ...!uunet!utai!utgpu!maccs!fred