lundi 29 décembre 2014

Bash -eq doesn't work, maybe because of cal


#!/bin/bash

i=0
d="$(date +%d)"
an="$(cal | awk '/[0-9]/ {print $2}' | tail -2)"
for e in $an
do
if [ "$d" -eq "$e" ]; then
i=1
fi
done

echo i=$i


The problem is with $an/$e but i don't understand why and how to fix it. I've looked and it don't have any spaces, they are numbers however bash don't think this way.


Aucun commentaire:

Enregistrer un commentaire