On 2/8/21 5:29 PM, gregrwm wrote:
   $ export vim=$HOME/.GVim-v8.2.2451.glibc2.15-x86_64.AppImage
   $
   $ vimV=$($vim --version)||echo handle error here              #without
export, error is captured
fuse: failed to exec fusermount: No such file or directory
open dir error: No such file or directory
handle error here
   $
   $ export vimV=$($vim --version)||echo handle error here       #with
export, error is lost
fuse: failed to exec fusermount: No such file or directory
open dir error: No such file or directory
   $

It's the assignment statement that's the oddball here; it's the only place
where the exit status from a command substitution has any effect. This is a
POSIX (maybe ksh) invention to provide assignment statements with a useful
exit status.

The `export' builtin completed successfully: it assigned the correct value
to `vimV' and marked it for export.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to