I am collecting windows system information using wmic
on Linux system. For that purpose, I make various wmic
calls and their output is stored in some variables. After required data is collected, I echo
those variables, separated by colons, to a file.
But, the problem arises when a variable stores 'null' value, as it does not display anything but just two successive colons.
How can printf
be utilized in order to display a 'hyphen' whenever there is a null value stored in a variable?
printf '%s\n' "${var:--}"
– Stéphane Chazelas Jan 14 '15 at 11:12var:--
part? – Mandar Shinde Jan 14 '15 at 11:13