Professional Documents
Culture Documents
fitxer en bash script utilitzarem el símbol > o >> seguit del nom del
fitxer.
El símbol > elimina el contingut previ del fitxer i, per tant, aquest només
#!/bin/bash
# File: script1.sh
echo "Running script1.sh">/var/log/script1.sh # if /var/log/script1.sh exists,
it will be removed.
# First instruction
echo "Instruction 1 executed"
# More instructions ...
# ....
echo "Finished script1.sh">>/var/log/script1.sh # append info to
/var/log/script1.sh .
Per tal de tenir un control dels errors podem redirigir la sortida per