Q: How do I find the length of the String in Bash
Ans: There are number of ways to find the length of the String in Bash.
Method 1:
$ word="technical world for you"
$ echo "${#word}"
23
$ echo "${#word}"
23
Method 2:
$ word="technical world for you"
$ expr length "$word"
23
$ expr length "$word"
23
Method 3:
$ word="technical world for you"
$ echo $word | awk '{print length}'
23
$ echo $word | awk '{print length}'
23
Method 4:
$ word="technical world for you"
$ echo -n $word | wc -c
23
$ echo -n $word | wc -c
23
Enjoy :)
If You Liked This Post Please Take a Time To Share This Post
Karayolu yurtdışı kargo
ReplyDeleteDenizyolu yurtdışı kargo
Havayolu yurtdışı kargo
Demiryolu yurtdışı kargo
Avusturya yurtdışı kargo
VFRD6