0
CURRTIME=$(perl -e ' print time(), "\n"')

FILETIME=$(cat timestamp.txt )

TIMEDIFF=$(($CURRTIME - $FILETIME))

I need to add 1 second to FILETIME variable, even if there is no entry in timestamp.txt, so CURRTIME has something to subtract for FILETIME. I'm using SunOS

please help

  • 1
    I'm not entirely sure I understand the question, but does TIMEDIFF=$(($CURRTIME - ${FILETIME:-0})) do what you need? BTW, I recommend using lower- or mixed-case variable names to avoid conflicts with the various all-caps names that have special meanings. – Gordon Davisson Jul 12 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.