Zdravim
V skriptoch obcas pouzivam na ochranu proti viacnasobnemu spusteniu lock subory a trap a vsetky vypisy davam do log suboru:
(
if { set -C; 2>/dev/null >$LOCKFILE; }; then
trap "rm -f $LOCKFILE" EXIT
else
echo `date`: "Lock file exists… exiting"
exit 1
fi
...
....
) 2>&1 >>log
Pokial to cele zabalim do subshelu (normalnymi zatvorkami), vsetko funguje. Ak to ale miesto subshellu zabalim do {}:
{
....
} 2>&1 >>log
tak trap uz nefunguje. Preco?