Skip to content

Instantly share code, notes, and snippets.

@jeremie-lesage
Created March 9, 2012 10:04
Show Gist options
  • Save jeremie-lesage/2005921 to your computer and use it in GitHub Desktop.
Save jeremie-lesage/2005921 to your computer and use it in GitHub Desktop.
Count number au slash in a string
#! /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