Here’s a simple little script that displays the number of characters in a string.
#!/bin/bash if [[ $# -eq 0 ]] ; then echo 'Missing arguments'; exit 0; fi var=$1 size=${#var} echo $size |
Command:
./length.sh abcdefghijklmnopqrstuvwxyz |
Output:
26 |
cloud engineer
Here’s a simple little script that displays the number of characters in a string.
#!/bin/bash if [[ $# -eq 0 ]] ; then echo 'Missing arguments'; exit 0; fi var=$1 size=${#var} echo $size |
#!/bin/bash if [[ $# -eq 0 ]] ; then echo 'Missing arguments'; exit 0; fi var=$1 size=${#var} echo $size
Command:
./length.sh abcdefghijklmnopqrstuvwxyz |
./length.sh abcdefghijklmnopqrstuvwxyz
Output:
26 |
26