Silence LOGFILE errors when using log too early
authorChristian Hofstaedtler <ch@grml.org>
Sat, 26 Nov 2011 15:37:03 +0000 (16:37 +0100)
committerChristian Hofstaedtler <ch@grml.org>
Sat, 26 Nov 2011 15:37:03 +0000 (16:37 +0100)
Relevant when quitting grml-live at the question stage.

grml-live

index 3f42b78..73ee61b 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -196,7 +196,7 @@ trap umount_all EXIT
 
 # log output:
 # usage: log "string to log"
-log() { echo "$*" >> $LOGFILE ; }
+log() { [ -n "$LOGFILE" ] && echo "$*" >> $LOGFILE ; }
 
 # cut string at character number int = $1
 # usage: cut_string 5 "1234567890" will output "12345"