Date: Tue, 15 Jun 2010 20:34:43 +0800 From: Aiza <aiza21@comclark.com> To: RW <rwmaillists@googlemail.com> Cc: freebsd-questions@freebsd.org Subject: Re: * wildcard in.sh script Message-ID: <4C177363.2050308@comclark.com> In-Reply-To: <20100615124709.254fe73e@gumby.homeunix.com> References: <4C173909.1050101@comclark.com> <4C174283.9090903@comclark.com> <20100615122014.44108373@gumby.homeunix.com> <20100615124709.254fe73e@gumby.homeunix.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is the output. want to build list only containing
file names prefixed with job. Putting " " around the value on the
command line worked. But before this can go to production will have to
fix the code so no " " on the command value.
# >admin "job*"
prefix_name1 = job*
prefix_name2 = job
if job* != job
list all1 = pen2
pen1
job_3
job_2
job_1
cell_B
cell_A
loop = pen2
pen1
job_3
job_2
job_1
cell_B
cell_A*
hard stop
This is the code. From the results above the "for" is not looping
through the file name list.
dir=/usr/local
prefix_name1=$1
prefix_name2=`echo -n "${prefix_name1}" | sed 's/*.*$//'`
echo "prefix_name1 = ${prefix_name1}"
echo "prefix_name2 = ${prefix_name2}"
echo " if ${prefix_name1} != ${prefix_name2}"
if [ "${prefix_name1}" != "${prefix_name2}" ]; then
[ -d "${dir}/etc/jail/" ] && \
cd "${dir}/etc/jail/" && list=`ls | xargs rcorder`
echo " list all1 = ${list}"
# know this worked because see it in the o/p
for jail in "${list}"*; do
echo "loop = ${jail}"
# this only shows first file name in the o/p
# though the * on the for command would do globbing
done
fi
exerr "hard stop"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C177363.2050308>
