![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help need to find the length of a variable | smr_rashmy | Shell Programming and Scripting | 7 | 02-18-2008 03:02 AM |
| use awk to read variable length csv | shweta_d | Shell Programming and Scripting | 3 | 06-17-2007 10:16 PM |
| Length of an indirect variable | gone_bush | Shell Programming and Scripting | 0 | 03-28-2006 04:17 PM |
| Set length for System Variable | bryanthomas | Shell Programming and Scripting | 2 | 01-12-2006 11:32 AM |
| creating a fixed length output from a variable length input | r1500 | Shell Programming and Scripting | 2 | 12-03-2003 10:09 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I have another question, I am very new to scripting. I am using c shell. I am trying to get the length of a variable. Right now I am using set var = 12 echo $#var but the # operator isn't working, it is telling me that the length is 1 when it is obviously two.... help! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Quote:
in your case try the one below, vLEN='echo ${#var}' Last edited by thumsup9; 02-08-2005 at 12:46 PM. |
|
#3
|
||||
|
||||
|
Quote:
|
|
#4
|
||||
|
||||
|
Quote:
Code:
% set blah = `echo "foo bar cog dog"` % echo $#blah 4 For example, with bash Code:
$ foo=12
$ echo ${#foo}
2
Cheers ZB |
||||
| Google The UNIX and Linux Forums |