Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Assign zero to the existing variable

$
0
0
Hi, I have a variable which read the value from the lines, and if it is empty string (5 bytes), then I have to assign this variable to zero "0", it able to detect the data is empty by showing me the message "empty", but not able to assign it as zero.

WTHP=`echo "$file" | cut -c158-162`

if [[ $WTHP = " " ]]
then
echo "empty" >> $Log
$WTHP = 0
echo "$WTHP=" $WTHP >> $Log
fi

it will show me error message "not found".
I have tried to code it as below:
1) WTHP = 0
OR
2) WTHP = [0]
OR
3) WTHP = "0"
OR
4) WTHP_1 = 0, then echo this variable, but still will failed to assign zero to this variable and show me same error message

Please advise.

Viewing all articles
Browse latest Browse all 13329

Trending Articles