I want to get the exit value (returned by $? on a shell; usually 0 or 1 for success or failure) of a external shell command in Vim. Note that I want to get its standard output too. So I can use the output and the also the exit value in a Vim conditional expression. Is this possible?
There is v:shell_error variable that has exactly the same value as $? in shell scripts. Works at least after :!, :read !, calling system().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With