In a script I have this code
path=/usr/namelist
for name in ${path}/${group}*; do
found_list=${found_list} ${found_name}
done
The done starts another loop. How do I code to know when the for has
completed. I want to echo results of for = ${found_list} to see the
accumulated contents.
it seems to work
your main error is to use ${found_name} instead of ${name}.
also, you do not set ${group} in your example.
and, not essential, but test -z before adding useless spaces.
correcting that, I had it working perfectly.
h2g2:~# cat test
path=/dev
group=tty
for name in
Samuel Martín Moro wrote:
it seems to work
your main error is to use ${found_name} instead of ${name}.
also, you do not set ${group} in your example.
and, not essential, but test -z before adding useless spaces.
correcting that, I had it working perfectly.
h2g2:~# cat test
path=/dev
group=tty
for name in ${path}/${group}*
do
path=/dev
group=ttypqfr
for name in ${path}/${group}*
do
test $name = ${path}/${group}* continue
[ -z ${found_list} ] found_list=${name} ||
found_list=${found_list} ${name}
done
echo found list: $found_list
Samuel Martín Moro
{EPITECH.} tek4
CamTrace S.A.S
Samuel Martín Moro wrote:
for name in ${path}/${group}*
do
path=/dev
group=ttypqfr
for name in ${path}/${group}*
do
test $name = ${path}/${group}* continue
[ -z ${found_list} ] found_list=${name} ||
found_list=${found_list} ${name}
done
echo found list: $found_list
Thank You Samuel.
On Tue, 22 Jun 2010 07:20:00 +0800
Aiza aiz...@comclark.com wrote:
test $name = ${path}/${group}* continue
[ -z ${found_list} ] found_list=${name} ||
I had not known about the 'test' command.
You have taught me something new.
In case you're not aware, [ -z ${found_list} ] is