Script question...
Charles Swiger
cswiger at mac.com
Mon Jan 12 15:34:27 PST 2004
On Jan 12, 2004, at 6:04 PM, Xpression wrote:
[ ...a question on how to change a shell script... ]
Try:
#! /bin/sh
path=/some/dir
if !([ -f $path/this.one ]); then
touch $path/this.one
for file in $path/file1 $path/file2 $path/file3; do
echo "-----------------------------------------" >>
$path/this.one
echo " $file" >> $path/this.one
echo "-----------------------------------------" >>
$path/this.one
cat $file >> $path/this.one
done
fi
Also note that using a local variable named $path is not a good idea,
since $PATH is highly important. :-) $path and $PATH are seperate in
/bin/sh, but many other shells automangle the colon-seperated $PATH
into the word-list format used by $path, and vice-versa.
--
-Chuck
More information about the freebsd-questions
mailing list