Solved

operand expected

Posted on 2008-10-20
9
1,156 Views
Last Modified: 2013-12-26
Dear All,
I m trying to execute this command
X60=$(($1 * 60))
error showing : operand expected (error token is " * 60")
TOTMINUTES=$(($X60 / $2))
error : operand expected (error token is "/")
how to eliminate this error
do i need to define using awk?
thanks
0
Comment
Question by:anju_a_sagar
  • 6
  • 3
9 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 22756639
are $1 and $2 defined?
0
 

Author Comment

by:anju_a_sagar
ID: 22756656
no how can i define them?
i know abt normal variables
can u plz explain
0
 
LVL 84

Expert Comment

by:ozo
ID: 22756673
What did you want to multiply by 60?
What did you want to divide it by?
0
 

Author Comment

by:anju_a_sagar
ID: 22756682
awk -f traveltime "$1" "$2"
is it like this
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:anju_a_sagar
ID: 22756690
i want to give those variables as user input
like this
traveltime 90 40
90 for $1 and 40 for $2
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 22756757
if traveltime is a bash script containing

#!/bin/bash
X60=$(($1 * 60))
TOTMINUTES=$(($X60 / $2))
echo $TOTMINUTES


then calling it like
traveltime 90 40

should print
135
0
 

Author Comment

by:anju_a_sagar
ID: 22757216
do i need to write in a file and save it with particular extension?
0
 

Author Comment

by:anju_a_sagar
ID: 22757267
X60=$(($1 * 60))
when i run this command
the following error is coming
-bash: * 60 : syntax error : operand expected (error token is "* 60")
0
 

Author Closing Comment

by:anju_a_sagar
ID: 31507782
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
countEvens challenge 2 78
has22 challenge 11 80
zeroFront challenge 7 80
Use of condition with 'serial' in ansible 2 50
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now