[HPADM] RE: Getting an absolute value

From: COUPRIE Kees (Kees.COUPRIE@swift.com)
Date: Fri Oct 13 2006 - 05:15:48 EDT


Getting an absolute value is pretty simple

# echo $a | tr -d -
or
# echo $a | sed 's/-//'

Best regards,
Kees Couprie
 
-- Save the earth. It's the only planet with chocolate.
 

>-----Original Message-----
>From: hpux-admin-owner@DutchWorks.nl
>[mailto:hpux-admin-owner@DutchWorks.nl] On Behalf Of Shaw, Marco
>Sent: Thursday, October 12, 2006 16:38
>To: hpux-admin@DutchWorks.nl
>Subject: [HPADM] Getting an absolute value
>
>Can't believe google doesn't provide an answer, searched these
>archives also!
>
>#a=`expr 2 - 1`
>#echo $a
>1
>#a=`expr 2 - 3`
>#echo $a
>-1
>
>I want to get the absolute value of the difference. I don't
>have to use expr, but also would prefer something available
>directly with the Borne shell.
>
>Marco
>
>--
> ---> Please post QUESTIONS and SUMMARIES only!! <---
> To subscribe/unsubscribe to this list, contact
>majordomo@dutchworks.nl
> Name: hpux-admin@dutchworks.nl Owner:
>owner-hpux-admin@dutchworks.nl
>
> Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin
>(FTP, browse only)
> http://www.dutchworks.nl/htbin/hpsysadmin (Web,
>browse & search)
>
>


--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:54 EDT