Last active
October 8, 2015 08:59
-
-
Save breun/3309543 to your computer and use it in GitHub Desktop.
This script lists all commands that appear more than once in your $PATH. For of each command its locations and the number of occurrences are displayed.
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 | |
# | |
# This script lists all commands that appear more than once in your $PATH. | |
# For of each command its locations and the number of occurrences are displayed. | |
# | |
# Nils Breunese <[email protected]>, 2012. | |
for command in `compgen -c` | |
do | |
count=`which -a $command | wc -l | tr -d ' '` | |
if [ "$count" -gt "1" ] | |
then | |
echo "$command: `which -a $command | tr '\n' ' '`($count)" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment