bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Idea: jobs(1) -i to print only :%ID:s


From: Andreas Schwab
Subject: Re: Idea: jobs(1) -i to print only :%ID:s
Date: Thu, 09 Nov 2023 22:17:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

On Nov 09 2023, Greg Wooledge wrote:

>     re='^\[([0-9]+)\]'
>     jobspecs=()
>     while IFS= read -r line; do
>         if [[ $line =~ $re ]]; then
>             jobspecs+=( "%${BASH_REMATCH[1]}" )
>         fi
>     done < <(jobs -l)

That fails for multi-line commands that happen to contain matches for
re.

$ (sleep 100; printf $'\n[100]\n') &

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]