Solved

Adding non-numeric values in korn shell script

Posted on 2002-05-04
3
609 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
Comment Utility
# not possible with ksh build-in commands, but try:
c=`echo $a $b|awk '{print $1+$2}'`
0
 

Author Comment

by:prasen120998
Comment Utility
Is there any other way for different shell?
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
AFAIK no. Only intgers possible.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
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…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

6 Experts available now in Live!

Get 1:1 Help Now