my "case" doesn't work !

I'm using the case statement in the following script and it always takes the "*" default choice while it should be "3".
I wonder why ???

dt_auj=`date +%d`

NBLOG=`ls -al /users/notes01/LOG/t*|awk '{print $7}'|grep $dt_auj|wc -l`

case $NBLOG in
1) cat ~/LOG/console-notes > $fic_tmp1 ;;
2) cat ~/LOG/console-notes ~/LOG/console-notes.0 > $fic_tmp1 ;;
3) echo "c'est le 3" ;;
4) cat ~/LOG/console-notes ~/LOG/console-notes.0 ~/LOG/console-notes.1 ~/LOG/console-notes.2 > $fic_tmp1 ;;
*) echo "c'est �toile" ;;
esac

somebody can help ?

thanks in advance

Christian

Comment out the case statement and just do an
echo "$NBLOG"

What's the value?

You might find there's a leading zero or whitespace to take care of.

Cheers
ZB

You're right , the value is in fact " 3" in place of "3".

Should i use any typeset command to keep only the value "3" ?

Christian

I corrected the NBLOG as :

NBLOG=`ls -al /users/notes01/LOG/t*|awk '{print $7}'|grep $dt_auj|wc -l|cut -c8 `

to suppress the blanks and it's ok !

Is there another to do this because we could have more than 8 columns ?

Christian

It's not very nifty, but pipe to awk
....| awk '{print $1}'

instead of cut, at the end of your pipe-chain

Cheers
ZB

That's fine !!!

thanks

Christian