Hi,
does anybody knows about wc -l, how to transform it inot a just number?
this script ALWAYS executes the command3!!, However, the value of BMU_RUNNING is 1
case $BMU_RUNNING in
*0) command1
;;
*1\) command 2;;
*\)command 3;;
esac
The variable is
BMU_RUNNING=`more channels.dat|grep BMU |grep RUNNING|wc -l`
and it is equal to 1
echo $BMU_RUNNING is 1
but with set -x
+ + more channels.dat
+ grep BMU
+ grep RUNNING
+ wc -l
BMU_RUNNING= 1
#!/bin/sh
BMU_RUNNING=`grep -c BMU_RUNNING channels.dat`
case "$BMU_RUNNING" in
*0) echo it is "* zero";;
*1) echo it is "* one";;
*) echo it is "*";;
esac
thanks blowtorch
that worked, I just modifiyes as my chnnels.dat file is something like:
CHANNEL(TO.BMUUZA1) STATUS(STOPPED)
CHANNEL(TO.YMQ2) STATUS(RUNNING)
CHANNEL(TO.BMUUZA1) STATUS(RUNNING)
CHANNEL(TO.YMQ1) STATUS(RUNNING)
to BMU_RUNNING=`grep BMU channels.dat|grep -c RUNNING`
case $BMU_RUNNING in
*0) echo `date`" WARNING, No Mainframe Channels TO.BMUAA1 are running "
echo " Please, start the channels or contact Mainframe transaction sy
stems team"
;;
*1\) echo \`date\`" One Mainframe Channels TO.BMUAA1 not running "
echo " Please, start the channel or contact Mainframe transaction sys