Tuesday, May 8, 2007

Length of a string in Linux

The command syntax is ${#string}

Example:
linuxdemon$lindem="linux demon"
linuxdemon$echo ${#lindem}
11

Explanation:
1.Assigning the string linux demon to the variable lindem.
2.Determining and printing the length of the string.

No comments: