I have a script with a function in it:
function install_log() {
echo "$1" >> $INSTALL_LOG_OUTPUT 2>&1
}
This function is working as it should. It is a function to write something into a log file.
I added some other commands to the script, for reading the given parameters of the script:
AUTOMATIC_INSTALL=
for argument in "$@"
do
install_log "-> parameter $argument"
if [ "$argument" == "--automatic" ] || ["$argument" == "-automatic" ]; then
AUTOMATIC_INSTALL=True
fi
done
install_log "# AUTOMATIC_INSTALL: $AUTOMATIC_INSTALL"
But with the new lines, I get some non needed messages:
$INSTALL_LOG_OUTPUT: ambiguous redirect
I found out, that this comes from the two lines
install_log "-> parameter $argument"
# ...
install_log "# AUTOMATIC_INSTALL: $AUTOMATIC_INSTALL"
Does anyone know, why the messages are occurring.
INSTALL_LOG_OUTPUT
being empty is one reason.test
of theif
statement. It should be[ "$argument" == "-automatic" ]; then
. It may or may not be related to the reported error.$INSTALL_LOG_OUTPUT
was three lines later -.-