List sh commands separately

This commit is contained in:
Joshua Peek 2011-08-23 11:34:03 -05:00
parent aade3ad781
commit 5a4bee6eb5

View file

@ -1,11 +1,25 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
if [ "$1" = "--sh" ]; then
sh=1
shift
fi
shopt -s nullglob shopt -s nullglob
{ for path in ${PATH//:/$'\n'}; do { for path in ${PATH//:/$'\n'}; do
for command in "${path}/rbenv-"*; do for command in "${path}/rbenv-"*; do
echo "${command##*rbenv-}" command="${command##*rbenv-}"
if [ -n "$sh" ]; then
if [ ${command:0:3} = "sh-" ]; then
echo ${command##sh-}
fi
else
if [ ${command:0:3} != "sh-" ]; then
echo $command
fi
fi
done done
done done
} | sort | uniq } | sort | uniq