Skip to content

Instantly share code, notes, and snippets.

@buffet
Created March 2, 2020 20:42
Show Gist options
  • Save buffet/e9e0b04e5c989e72ab560e087c92e983 to your computer and use it in GitHub Desktop.
Save buffet/e9e0b04e5c989e72ab560e087c92e983 to your computer and use it in GitHub Desktop.
compgen.sh
#!/bin/sh
IFS=:; for dir in $PATH; do
for file in "$dir"/*; do
if test -f "$file" -a -x "$file"; then
printf '%s\n' "${file##*/}"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment