[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: export loses error
From: |
Chet Ramey |
Subject: |
Re: export loses error |
Date: |
Tue, 9 Feb 2021 10:23:51 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
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 chet@case.edu http://tiswww.cwru.edu/~chet/