I have the following command that I am trying to put into a bash alias. The command by itself works fine, but when I try to alias it, I am getting the following errors:
The Command
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c 'echo "$(find "{}" -type f | wc -l)" {}' \; | sort -nr
The Alias
alias csfiles='find . -maxdepth 1 -mindepth 1 -type d -exec sh -c 'echo "$(find "{}" -type f | wc -l)" {}' \; | sort -nr'
The Error:
-sh: alias 0: not found
-sh: alias {} \; | sort nr: not found
I think this means I am not using quotes right but I am having trouble determining the correct combo. Help?