Hi there,
Sorry if the title doesn't mean much to you, I don't know how to sum up my pb in one line.
I'd like to set a value to 0 or 1 depending on the result of a comparison. Here's what I do:
supernova:~# a=
supernova:~# isempty=$([[ -z $a ]] && echo 1 || echo 0)
supernova:~# echo $isempty
1
supernova:~# a=something
supernova:~# isempty=$([[ -z $a ]] && echo 1 || echo 0)
supernova:~# echo $isempty
0
Is there any more trivial way to do that?
Thans in advance
Santiago