Sponsored Content
Operating Systems Solaris Korn shell - evaluating string gives wrong results due to limitations Post 302832991 by Don Cragun on Tuesday 16th of July 2013 05:20:25 AM
Old 07-16-2013
Quote:
Originally Posted by jlliagre
"6" as output is dubious:

Legacy ksh (ksh88, integer arithmetics):
Code:
$ echo $((5.2+2.5))
7

Current ksh (ksh93, floating point arithmetics):
Code:
$ echo $((5.2+2.5))
7.7

You may have been mislead by some of my guesses at what might be going on. The original statement was that the command:
Code:
echo $(5.2+2.5)

(note the single set of parentheses) when processed by an unspecified version of the Korn shell produces the output
Code:
6

Note that psychocandy has yet to answer the question: What does the command
Code:
type 5.2+2.5

produce on a system where echo $(5.2+2.5) prints 6?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script giving wrong results....

hi, I have this script which gives me the result... #! /usr/bin/sh set -x cd /home/managar a=1 while true do if then echo " File log.txt exists in this directory " exit 0 fi echo " File has not arrived yes..." sleep 3 let a=a+1 if then (1 Reply)
Discussion started by: mgirinath
1 Replies

2. Shell Programming and Scripting

How to: Parse text string into variables using Korn shell

I am writing a script to keep check on free disk space, and I would like to find a way to parse $LINE (see code below) into a numeric value (for free disk space percentage) and a string value (for mount point). If possible, I would like to avoid sed or any additional use of awk since I am not very... (7 Replies)
Discussion started by: shew01
7 Replies

3. Shell Programming and Scripting

Evaluating command output (shell script )

Hello, in a script i would like to evaluate a command output with a grep, for example, to know if the parameter defined by the user is in the output. Something like: the_command | grep $1 Please, how is the way to evalulate in this a script, like if echo "incorrect parameter, not in... (2 Replies)
Discussion started by: aristegui
2 Replies

4. Shell Programming and Scripting

K Shell evaluating value to a variable

Hi, I have the following requirement. V="First" R="V" echo $$R The output should be First. How do i achieve this. how do we evaluate the $R and evaluate it to $V as $R contains V and $V is First. Thanks Vijay (2 Replies)
Discussion started by: vijaykrc
2 Replies

5. Solaris

Can't install Unicode::String due to String.so not found

CPAN.pm: Going to build G/GA/GAAS/Unicode-String-2.09.tar.gz Checking if your kit is complete... Looks good Writing Makefile for Unicode::String cp String.pm blib/lib/Unicode/String.pm cp lib/Unicode/CharName.pm blib/lib/Unicode/CharName.pm /usr/bin/perl /usr/perl5/5.8.4/lib/ExtUtils/xsubpp... (5 Replies)
Discussion started by: PatrickBaer
5 Replies

6. Shell Programming and Scripting

String parsing in Korn Shell

Hi everybody, I have a string stored in a variable called record: record="SNMPv2-SMI::ent.9.9.43.1.3.9.2 = Timeticks: (177330898) 20 days, 12:35:08.98" I want to write some regular expressions good for Korn Shell to extract the number between parenthesis, in this case 177330898, and put it in... (3 Replies)
Discussion started by: omoyne
3 Replies

7. Shell Programming and Scripting

korn shell: check the content of a string of a variable

hello, i have a variable which should have following content : var="value1" or var="value2" or var="value2:*" # example: value2:22 how can i check : - if the content is ok (value1 / value2* ) - the two options of "value2" when content is example "value2:22" , i want to split... (3 Replies)
Discussion started by: bora99
3 Replies

8. Shell Programming and Scripting

awk evaluating a string as a math expression

Hi, I am writing a script in awk trying to replace strings that are math expressions with their result. For example, I have a file that looks like this: 5-1 32/8-1 4*12 17+1-3 I would like to get the following output: 4 3 48 15 I tried doing it the following way (using the "bc"... (8 Replies)
Discussion started by: avi.levi
8 Replies

9. Shell Programming and Scripting

Korn Shell manipulating the string into dynamic currency number

Conversion of string into currency value.. ex1: number_of_positions=2 input_string=345987 Output= 345,987.00 ex2: number_of_positions=4 input_string=1345987 Output= 1,345,987.0000 Please respond as soon as possible edit by bakunin: we will gladly respond as soon as... (15 Replies)
Discussion started by: suren.bills
15 Replies

10. IP Networking

Packet going out of wrong interface due to OS automatically added cache route with lower metric

RHEL 7.0, IPV6 Scenario: I have routed specific network using network scripts. 1. "ip -6 route show" shows that route has been added. ( with metric 1024) 2. Ping of the specific IP through that route is successful. 3. Now after few days, for some reason, we see that cache route appears for... (3 Replies)
Discussion started by: msr1981
3 Replies
Locale::Codes::LangFam(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangFam(3pm)

NAME
Locale::Codes::LangFam - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangFam; $lext = code2langfam('apa'); # $lext gets 'Apache languages' $code = langfam2code('Apache languages'); # $code gets 'apa' @codes = all_langfam_codes(); @names = all_langfam_names(); DESCRIPTION
The "Locale::Codes::LangFam" module provides access to standard codes used for identifying language families, such as those as defined in ISO 639-5. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 639-5 language family codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language families. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langfam('apa','alpha'); $lext = code2langfam('apa',LOCALE_LANGFAM_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from ISO 639-5 such as 'apa' for Apache languages. This is the default code set. ROUTINES
code2langfam ( CODE [,CODESET] ) langfam2code ( NAME [,CODESET] ) langfam_code2code ( CODE ,CODESET ,CODESET2 ) all_langfam_codes ( [CODESET] ) all_langfam_names ( [CODESET] ) Locale::Codes::LangFam::rename_langfam ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangFam::add_langfam ( CODE ,NAME [,CODESET] ) Locale::Codes::LangFam::delete_langfam ( CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_alias ( NAME ,NEW_NAME ) Locale::Codes::LangFam::delete_langfam_alias ( NAME ) Locale::Codes::LangFam::rename_langfam_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::delete_langfam_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.loc.gov/standards/iso639-5/id.php ISO 639-5 . AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-11-04 Locale::Codes::LangFam(3pm)
All times are GMT -4. The time now is 04:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy