Hi,
I have a variable in my script that gets its value from a procstack output. It could be a number of any length, or it could just be a '1' with 0 or more white spaces around it. I would like to detect when this variable is just a 1 and not a 1234, for example. This is as far as I got:
#!/bin/ksh
var1="1"
if [[ ${var1} = ^1$ ]] then
echo $var1
else echo "Bad"
fi
exit
And the execution goes like this:
./borrame.sh
Bad
How can I get it to check that the value is just 1, with either spaces or not around it, but cernainly not digits?
Thanks in advance. I get the feelign this is quite easy-peasy but I can�t get my head around regular expressions yet.
T.