good debugging, yea i missed the n # count char, i type stupidly from a cell foun, .. and yea leftover arr ekements exceots when u just use the first one as n i just wanted to show shorter code
i also made somewhen a which_pid_exited resolver etc peace On Fri, Jul 2, 2021, 11:10 Phi Debian <phi.deb...@gmail.com> wrote: > > > On Fri, Jul 2, 2021 at 9:24 AM Alex fxmbsw7 Ratchev <fxmb...@gmail.com> > wrote: > >> jobsn=( $( jobs -p ) ) jobsn=${jobsn[@]} >> > > This give > PW$ jobsn=( $( jobs -p ) ) jobsn=${jobsn[@]} > PW$ echo $jobsn > 3644 3645 3646 3647 > > I guess you meant jobsn=${#jobsn[@]} > ^ You missed the '#' > > Yet there are some left over > PW$ jobsn=( $( jobs -p ) ) jobsn=${#jobsn[@]} > PW$ echo ${jobsn[@]} > 4 3645 3646 3647 > > So it is not clean, and the OP want a function with a named output arg. > > Yet to elaborate on your technic may be this one is a little cleaner > > PW$ jobsn=$(printf '%c' $(jobs -p)) jobsn=${#jobsn} ; echo $jobsn > 4 >