[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: simple prob?
From: |
Phi Debian |
Subject: |
Re: simple prob? |
Date: |
Fri, 2 Jul 2021 11:10:32 +0200 |
On Fri, Jul 2, 2021 at 9:24 AM Alex fxmbsw7 Ratchev <fxmbsw7@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