mercredi 14 janvier 2015

How to print 'hypens' if a variable contains null value


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?



Aucun commentaire:

Enregistrer un commentaire