The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
problem, with if condition in function gurukottur Shell Programming and Scripting 4 04-24-2008 03:57 PM
Problem with function script. gzs553 Shell Programming and Scripting 3 04-21-2008 04:15 PM
Problem with Recursive function malle Shell Programming and Scripting 4 02-03-2007 10:40 AM
PERL function problem avadhani Shell Programming and Scripting 2 06-15-2005 05:18 AM
Problems with Strlen ACeD High Level Programming 5 02-28-2002 05:53 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 07-24-2003
steiner steiner is offline
Registered User
  
 

Join Date: Jul 2003
Location: Hambach - France
Posts: 29
Problem with the strlen function in ksh

Hello,

Just a little problem with the ksh function : strlen

I want to use this function in this little ksh program :

while read line ; do
TOTO=$line
TOTONB=strlen($TOTO)
echo $TOTONB
  #2 (permalink)  
Old 07-24-2003
steiner steiner is offline
Registered User
  
 

Join Date: Jul 2003
Location: Hambach - France
Posts: 29
Problem with the strlen function in ksh

Hello,

Just a little problem with the ksh function in this program

while read line ; do
TOTO=$line
TOTONB=strlen ($TOTO)
echo $TOTONB
echo $line
done

So i have no value return in TOTONB , so i think that strlen don't work correctly . The doc don't give me any explications to avance in my problem.

I also test with the following lines :

TOTONB=$(strlen($TOTO)) --> don't work
TOTONB=strlen[$TOTO] --> don't work

Have anyone the good syntax or a explication for this problem

Thanks a lot...
  #3 (permalink)  
Old 07-24-2003
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,120
You have ksh mixed up with C or something. ksh has no strlen function. You can get the length of a string with:
string="something"
echo ${#string}
  #4 (permalink)  
Old 07-24-2003
steiner steiner is offline
Registered User
  
 

Join Date: Jul 2003
Location: Hambach - France
Posts: 29
strlen in ksh

Hello,

Your command is fun , it's run .

A have read a lot of documentation of the strlen function (all in C)and nowhere it's write that this function is not available in ksh.

Thanks a lot for your help...
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 03:58 PM.


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