The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
arithmetic in tcsh gobi Shell Programming and Scripting 4 05-28-2008 06:05 PM
Can I use wc -l with arithmetic expression? lalelle Shell Programming and Scripting 3 08-11-2007 03:44 PM
arithmetic in ksh amon Shell Programming and Scripting 12 02-04-2007 11:43 PM
Arithmetic In UNIX tygun UNIX for Dummies Questions & Answers 3 11-23-2005 02:46 PM
arithmetic problem inquirer UNIX for Dummies Questions & Answers 2 02-19-2002 11:27 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-10-2004
Registered User
 

Join Date: May 2004
Posts: 1
arithmetic syntax

okay, I'm a complete beginner, and I keep getting stuck on the syntax here. I want to write a script where I read the current time as minutes and seconds, convert the minutes to seconds, and add the two, then redirect the output to a file. the command takes two arguments, which will also be redirected to the file. This is what I have:

echo $1: $2: >> tmk
set min=`date +%M`
set sec=`date +%S`
set total=`($min * 60) + $sec`
echo $total >> tmk

I keep getting a badly placed bracket error on the set total line. Any suggestions?

I want to be able to use the script to input a number of times, then add or subtract them depending on the first two arguments at a later time.
Reply With Quote
Forum Sponsor
  #2  
Old 05-11-2004
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Looks like csh - try @ total = ($min * 60) + $sec
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0