Created
February 5, 2018 23:24
-
-
Save turing4ever/eccacc2b65aed1857dd13e53b7310c8b to your computer and use it in GitHub Desktop.
How to figure out the length of a string in bash?
This file contains 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
# How to figure out the length of a strign in bash? | |
#expr length | |
expr length "string" #This works on Ubuntu, but not on Mac | |
#wc -c | |
echo -n "string" | wc -c # -n not to output trailing newline in echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment