Is it possible to silently run an external command, but show the output on the prompt only if there was any?
1 Answer
If by external command you do mean shell commands then you can try using system
function :h system()
:
No output (on Windows)
let s:output = system("title")
if s:output != ''
echom s:output
endif
Output
let s:output = system("date")
if s:output != ''
echom s:output
endif
let output = system(...)
and then check if output is not empty and echo output