Hi All
Just started with shell scripts and am stumped by, what is to most of you no doubt, a simple issue.
All I'm trying to do is prompt a user for input and writing to a log file. If the user types the word 'stop', then the program should halt. If the word typed is 'clear', then the log file should be cleared.
Starting simply(!), all I've got so far is:
LOGDIR=/some/dir/
TARGETFILE="whatever"
ans="abc"
while [ ${ans} != "stop" }
do
echo "Enter text:"
read ${ans}
echo ${ans} >>${LOGDIR}/${TARGETFILE}
done
All that happens is the original value of "abc" is written to the log. Obviously the variable isn't being overwritten by the user input. Can anyone help with basic help for a newbie?