Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- #Description: Recibe un año como parámetro y devuelve 0 si es bisiesto o -1 si no lo es
- #
- #Author:jMa
- #
- echo $1 | grep -x -q "[0-9]\+"
- num=$?
- if [ $num != 0 ]
- then
- echo "Introduce un año correcto"
- exit -1
- fi
- if [ `cal 2 $1| grep "29" | wc -c` -gt 0 ]
- then
- exit 0
- else
- exit -1
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment