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