Solved

operand expected

Posted on 2008-10-20
9
1,153 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Separate into files by filename 12 67
Separate files macro - Errors on larger data set 18 56
List out all word 7 224
wordappend challenge 8 88
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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