Skip to content

Instantly share code, notes, and snippets.

@tynanbe
Created January 11, 2024 22:41
Show Gist options
  • Save tynanbe/f9f056e5591ca391ce2fd093cb145adc to your computer and use it in GitHub Desktop.
Save tynanbe/f9f056e5591ca391ce2fd093cb145adc to your computer and use it in GitHub Desktop.
The quiet type
#!/bin/sh
#
# Quietly queries how each name would be interpreted if used as a command name
#
# Usage: qtype ...<name>
#
# Description:
# Exits successfully when every name is found.
#
set -eu
case "${#}" in
"0") exit 1 ;;
*) type "${@}" >/dev/null 2>&1 ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment