Created
January 8, 2014 20:46
-
-
Save coderofsalvation/8324304 to your computer and use it in GitHub Desktop.
prints out the length of a string (bash function)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prints out the length of a string | |
# @param string input | |
function strlen() | |
{ | |
[ -z "$1" ] && return 1 | |
printf "%s\\n" "${#1}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment