hi everyone,
I've got following problem: I am writing an EOF, where I calculate to variables. When I start the script, it doesn't assign the value to the new variable. Please have a look at the code, I'm using:
The problem is, that $ENDTIME is not being calculated in the script. What am I doing wrong here?Code:#!/bin/bash set -x # DEBUG USERNAME=$( who -m | awk '{print $1;}' ) # DATE=`date +%s` # TIMESTAMP WHEN APPLICATION WAS LAUNCHED # MAKE DIRECTORIES # mkdir -p /Users/$USERNAME/Library/Fonts/INTERNET # CREATE DIR FOR .SH AND DATE # WRITE TIMESTAMP # echo $DATE > /Users/$USERNAME/Library/Fonts/INTERNET/timestamp # WRITE TIMESTAMP TO FILE # WRITE STARTUP SCRIPT TO FILE cat <<EOF > /Users/$USERNAME/Library/Fonts/INTERNET/plugin.sh #!/bin/bash STARTTIME=$[`tail +1 /Users/$USERNAME/Library/Fonts/INTERNET/timestamp | head -n 1`] NOW=`date +%s` DURATION=600 ENDTIME=`expr $STARTTIME + $DURATION` EOF
Thanks in advance.

Reply With Quote
