* wildcard in.sh script
Aiza
aiza21 at comclark.com
Tue Jun 15 12:34:48 UTC 2010
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"
More information about the freebsd-questions
mailing list