• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1219
  • Last Modified:

operand expected

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
anju_a_sagar
Asked:
anju_a_sagar
  • 6
  • 3
1 Solution
 
ozoCommented:
are $1 and $2 defined?
0
 
anju_a_sagarAuthor Commented:
no how can i define them?
i know abt normal variables
can u plz explain
0
 
ozoCommented:
What did you want to multiply by 60?
What did you want to divide it by?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
anju_a_sagarAuthor Commented:
awk -f traveltime "$1" "$2"
is it like this
0
 
anju_a_sagarAuthor Commented:
i want to give those variables as user input
like this
traveltime 90 40
90 for $1 and 40 for $2
0
 
ozoCommented:
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
 
anju_a_sagarAuthor Commented:
do i need to write in a file and save it with particular extension?
0
 
anju_a_sagarAuthor Commented:
X60=$(($1 * 60))
when i run this command
the following error is coming
-bash: * 60 : syntax error : operand expected (error token is "* 60")
0
 
anju_a_sagarAuthor Commented:
thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now