test number within a range
I am trying to test whether a number is assigned to a variable and is it within certain range (in a single line statement).
But the below code is giving an error saying -z is an unknow operator. Any clues on how to implement or mistake i have made Code:
[[-z "$Id"] -o [!grep -q $Id [1-8]]] && _Function1 |
When using complex tests (-o or -a) you can't use the double brackets. Try somethiong like this:
Code:
[[ -z "$Id" ]] || [[ ! $(grep -q $Id [1-8]) ]] && _Function1 Code:
[ -z "$Id" -o ! $(grep -q $Id [1-8]) ] && _Function1 |
Quote:
Code:
id=8 |
All times are GMT -5. The time now is 09:23 AM. |