help-bash
[Top][All Lists]
Advanced

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

Re: warning rookie question - how to get return value


From: grumpy
Subject: Re: warning rookie question - how to get return value
Date: Tue, 3 Nov 2026 16:58:40 -0600 (CST)

On Tue, 3 Nov 2026, Greg Wooledge wrote:

On Tue, Nov 03, 2026 at 12:04:10 -0600, grumpy@manlymail.net wrote:
read x < <(do_my_app)

how do i get the return value for do_my_app

Do you mean the exit status?  In sufficiently new versions of bash,
you can explicitly wait for it:

hobbit:~$ read -r x < <(echo true; exit 37)
hobbit:~$ wait $!
hobbit:~$ echo $?
37

This requires bash 4.4 or newer.  If you need the exit status of that
command in an older version of bash, you'll need to throw away the process
substitution syntax, and use a named pipe and explicit background jobs.


yes exit status
wrong terminology
apologizes
thanks



reply via email to

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