10 More Discussions You Might Find Interesting
1. Solaris
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
Hello All,
In ksh I am trying to ensure that user inputs are integers otherwise redisplay prompt with the following code;
a=0
b=0
c=0
read b?"Please enter a number: "
read c?"Please enter another number: "
while ] && ]; do
read b?"Not a number. Please enter a number: "
read c?"Not... (4 Replies)
Discussion started by: techieg
4 Replies
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
Hi fellows!!
i'm doing something which is not working out for me properly which i don't understand why
nowdate=`date +%s`
echo $nowdate
now the problem how to convert a date which is stored in a variable
mydate="22/Oct/2011"
mydate=`date -d '$mydate' +%s`
it gives error... (11 Replies)
Discussion started by: me_newbie
11 Replies
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
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
7. UNIX for Dummies Questions & Answers
Hiii
I actually intent to check the integer or floating point number input by user i.e. 23, 100, 55.25, 12.50 ..etc. However, when someone input strings or alpha character, my program has to show invalid input.!! Is there any Unix shell script syntax can help me to check ?
Thanking you (2 Replies)
Discussion started by: krishnampkkm
2 Replies
8. UNIX for Dummies Questions & Answers
Hi all,
is there an easy way to convert integer to string in bash?
I have numbers like 1, 2, ..., 112, ...
and I would like to get
001 002 003 004 ...
Thank you,
Sarah (4 Replies)
Discussion started by: f_o_555
4 Replies
9. UNIX for Dummies Questions & Answers
HI
I want to round off an integer to the next multiple of 10 in shell script.
(i.e.,) 91 should be rounded off to 100
and 90 should be rounded off to 90
It would be very helpful, if you can help me in this.
Thanks in advance (4 Replies)
Discussion started by: dayamatrix
4 Replies
10. Shell Programming and Scripting
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