Wrong Integer value


 
Thread Tools Search this Thread
Operating Systems Linux Wrong Integer value
# 1  
Old 10-06-2011
octal conversion taking place with the leading zeros.
Code:
~/$ printf "%o\n" 3776
7300

EDIT: It's happening in my workstation which uses ksh93 (Ubuntu) but not the ksh on my server, RHEL-4.8 pdksh-5.2.14-30.6
Perhaps installing pdksh if you are working under ksh93 would resolve
Confirmed (invoking pdksh on my workstation resolves the issue):
Code:
~/$ pdksh 
$ integer x=007300
$ echo $x
7300


Last edited by Skrynesaver; 10-06-2011 at 06:32 PM.. Reason: REalised I was answering the wrong question and subsequently made it clear where the outout was from
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Integer Validation

Hi Using the below logic to check whether the value is integer or not and converting the value to decimal if not. int_chck = sprintf(substr($i, 1, 2)) o_cnt = 'if ; then echo $int_chck; else echo $((0x$int_chck)); fi' Thanks, Dines (4 Replies)
Discussion started by: dineshnak
4 Replies

2. Shell Programming and Scripting

String to integer

I am on HP-UX using ksh in the script. MaxSal=`sqlplus -silent /nolog <<EOF connect / as sysdba whenever sqlerror exit sql.sqlcode set pagesize 0 feedback off verify off heading off echo off select max(sal) from emp1; select max(sal) from emp2; select max(sal) from emp3; exit; EOF`... (3 Replies)
Discussion started by: bang_dba
3 Replies

3. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

4. Shell Programming and Scripting

how to compare string integer with an integer?

hi, how to I do this? i="4.000" if ; then echo "smaller" fi how do I convert the "4.000" to 4? Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies

5. Solaris

How to Use a Variable as Integer?

hello, i am writing a script that takes the UID from the PASSWD and then i want to increse the Number by one. for the Next user. i cannot get this to work that a variable is as interger example: set i = 0 set $i = $+1 it's in tcsh if it's mather (10 Replies)
Discussion started by: shatztal
10 Replies

6. Shell Programming and Scripting

Alphanumeric to integer

Hi folks, I have a value like A12,i could able to change this into integer using typeset as below typeset -i A12 But, I need your advice to change the values like 1A2 or 12A into integer. Thanks in advance. Thanks, Sathish (3 Replies)
Discussion started by: bsathishmca
3 Replies

7. Shell Programming and Scripting

Regex for for integer from 0-7 except 2

Hi, I am trying to use a regular exp to match any number between 0 and 7 except 2...... I am using: echo $myvar | egrep "{1}{1}" Which isnt working.... Please can someone help? Thanks yonderboy (10 Replies)
Discussion started by: yonderboy
10 Replies

8. Shell Programming and Scripting

reverse an integer

i have created a script that will reverse any given ineter. #!/bin/ksh echo "Enter the number" read n if then a=`expr $n / 10` b=`expr $n % 10` c=`expr $b \* 10 + $a` fi echo $c --------------------------------------------------------------------- the problem with this script... (4 Replies)
Discussion started by: ali560045
4 Replies

9. Shell Programming and Scripting

Cannot store integer value

Hi , I have code like below in my ksh script, but getting an error as SP2-0253: data item 1 ("SAMPLE_ID") will not fit on line , pls help me. thanks. if (( CHECKS == 0 )) || (( CHECKS == 1 )) then V_SAMPLE_ID=$( $ORACLE_HOME/bin/sqlplus -S / <<EOF whenever sqlerror exit 1... (5 Replies)
Discussion started by: bennichan
5 Replies

10. Shell Programming and Scripting

get integer part

Hi, I did a df|awk| command and it returns a percentage "94%", how could I only get the integer part "94" out of it, so I can compare it to another number, I knwo that I have to pipe it to sth, but "grep " did not work, it still give me number WITH the percentage, does someone know what... (3 Replies)
Discussion started by: ericaworld
3 Replies
Login or Register to Ask a Question
LDAP_GET_OPTION(3)							 1							LDAP_GET_OPTION(3)

ldap_get_option - Get the current value for given option

SYNOPSIS
bool ldap_get_option (resource $link_identifier, int $option, mixed &$retval) DESCRIPTION
Sets $retval to the value of the specified option. PARAMETERS
o $link_identifier - An LDAP link identifier, returned by ldap_connect(3). o $option - The parameter $option can be one of: +--------------------------+---------+ | Option | | | | | | | Type | | | | +--------------------------+---------+ | | | | LDAP_OPT_DEREF | | | | | | | integer | | | | | | | | LDAP_OPT_SIZELIMIT | | | | | | | integer | | | | | | | | LDAP_OPT_TIMELIMIT | | | | | | | integer | | | | | | | |LDAP_OPT_NETWORK_TIMEOUT | | | | | | | integer | | | | | | | |LDAP_OPT_PROTOCOL_VERSION | | | | | | | integer | | | | | | | | LDAP_OPT_ERROR_NUMBER | | | | | | | integer | | | | | | | | LDAP_OPT_REFERRALS | | | | | | | bool | | | | | | | | LDAP_OPT_RESTART | | | | | | | bool | | | | | | | | LDAP_OPT_HOST_NAME | | | | | | | string | | | | | | | | LDAP_OPT_ERROR_STRING | | | | | | | string | | | | | | | | LDAP_OPT_MATCHED_DN | | | | | | | string | | | | | | | |LDAP_OPT_SERVER_CONTROLS | | | | | | | array | | | | | | | |LDAP_OPT_CLIENT_CONTROLS | | | | | | | array | | | | +--------------------------+---------+ o $retval - This will be set to the option value. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Check protocol version <?php // $ds is a valid link identifier for a directory server if (ldap_get_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version)) { echo "Using protocol version $version "; } else { echo "Unable to determine protocol version "; } ?> NOTES
Note This function is only available when using OpenLDAP 2.x.x OR Netscape Directory SDK x.x. SEE ALSO
ldap_set_option(3). PHP Documentation Group LDAP_GET_OPTION(3)