- Hello I made a bash script, with a ccase, but it doesn't select the '? )' option. Here is the script:
#!/bin/bash
case $1 in
'pepe' )
valor='10k'
valor2='15k' ;;
'pepa' )
valor='12k'
valor2='17k' ;;
'pepeon' )
valor='20k'
valor2='25k' ;;
? )
echo 'Hay que elegir algo'
exit 0
esac
echo '$1 $valor $valor2'
The problem is that it never gives me the error echo 'Hay que elegir algo', if i don't put any of the values that the case have. How can i fix it to give me that echo message when I put an opion that is not pepe, pepa or pepon?
Thanks.
|