The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Converting integer to String ROOZ Shell Programming and Scripting 1 06-05-2008 02:38 PM
Converting a String variable into Integer neeto UNIX for Dummies Questions & Answers 2 05-22-2008 04:38 PM
Converting a decimal into integer idro Shell Programming and Scripting 4 10-31-2007 01:51 PM
Integer to String psilva High Level Programming 2 08-17-2001 01:14 PM
convert from an integer to a string mojomonkeyhelper UNIX for Dummies Questions & Answers 6 03-29-2001 05:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-04-2005
esham's Avatar
esham esham is offline
Registered User
  
 

Join Date: Nov 2004
Location: INDIA
Posts: 107
command for converting string to integer

Hi ...

I am trying to calculate the time needed for a command to execute..

but the resulting value is getting as string..

Quote:
(time -p cp /home/esham/speedtemp3 /home/ ) 2>file ; grep sys file | cut -d" " -f 2
so i am not able to use "expr " command..

please help me to convert the value to integer so that i can proceed with my script..

Regards

esham
  #2 (permalink)  
Old 08-04-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Use bc

Say TIME=0.02


Code:
echo $TIME+1 | bc -l

will give

[~]$ echo $TIME+1 | bc -l
1.01


vino
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:06 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0