Solved

operand expected

Posted on 2008-10-20
9
1,175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 

Author Comment

by:anju_a_sagar
ID: 22756682
awk -f traveltime "$1" "$2"
is it like this
0
 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Include multiple hostnames in this command? 3 55
has77  challenge 9 98
Sed question 2 124
Authenticate using sesu from script 7 116
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

726 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