Solved

Adding non-numeric values in korn shell script

Posted on 2002-05-04
3
614 Views
Last Modified: 2013-12-26
I want to add non-numeric values i korn shell script, how do I do it. expr doesn't work for non-numeric values.    
eg, $a=1.00 $b=2.00, how do I get $a+$b in shell scripts?
0
Comment
Question by:prasen120998
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 6989946
# not possible with ksh build-in commands, but try:
c=`echo $a $b|awk '{print $1+$2}'`
0
 

Author Comment

by:prasen120998
ID: 7001760
Is there any other way for different shell?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7002885
AFAIK no. Only intgers possible.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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
how to monitor remote shell execution on linux 9 105
maven archtype selection in eclipse 1 58
Unix Command -- Challenging  question 7 101
Sed question 2 120
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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.

679 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