Re: .sh for loop

2010-06-21 Thread RW
On Tue, 22 Jun 2010 07:20:00 +0800 Aiza 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 als

Re: .sh for loop

2010-06-21 Thread Aiza
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" T

Re: .sh for loop

2010-06-21 Thread Samuel Martín Moro
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.}

Re: .sh for loop

2010-06-21 Thread Aiza
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 f

Re: .sh for loop

2010-06-21 Thread Samuel Martín Moro
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}

.sh for loop

2010-06-21 Thread Aiza
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