how to add or subtract in linux script

November 30, 2011 at 10:18:32
Specs: linux
Write a function that reads a value from the file "date file", subtract this value from the current number of seconds since 1 / 1 in 1970, and prints this value

See More: how to add or subtract in linux script

Report •

#1
November 30, 2011 at 12:08:02
This returns the number of seconds using the GNU/Linux date command:

secsfromepoch=$(date '+%s')
echo $secsfromepoch

# bash arithmetic, section 17:
http://linuxconfig.org/Bash_scripti...

# another link explaining bash arithmetic
http://www.softpanorama.org/Scripti...

I'll leave the rest of your homework to you.


Report •

#2
January 5, 2012 at 04:55:27
Write a function that reads a value from the file "date file", subtract this value from the current number of seconds since 1 / 1 in 1970, and prints this value

Report •
Related Solutions


Ask Question