Created
March 9, 2012 10:04
-
-
Save jeremie-lesage/2005921 to your computer and use it in GitHub Desktop.
Count number au slash in a string
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
#! /bin/bash | |
path=/usr/lib/ | |
slash="${path//[^\/]/}" | |
echo "Depth : $(expr ${#slash} - 1)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment