I stumbled across this post where user chepner proposed in his answer the usage of \j
(as mentioned in the bash manual) to retrieve the current running count of background jobs.
Basically it boils down to
num_jobs="\j"
echo ${num_jobs@P}
Can anyone enlighten me on what is going on here exactly? E.g.
- why
${\j@P}
is not working and - what
@P
is doing exactly?