help-bash
[Top][All Lists]
Advanced

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

255 return code from wait builtin


From: Ian
Subject: 255 return code from wait builtin
Date: Wed, 22 Jan 2025 12:39:44 +0000

Hi,

When I wrap the wait builtin with a command substitution it returns a 255 code. 
Why is this?

# This seems normal
sleep 1 &
wait $!
echo $? # prints "0"

# This is surprising
sleep 1 &
a=$(wait $!)  # <---- only difference is cmd substitution
echo $? # prints "255"

Thanks



reply via email to

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