Skip to content

Instantly share code, notes, and snippets.

@Qyriad
Created February 15, 2024 19:46
Show Gist options
  • Select an option

  • Save Qyriad/c40965bc30add5821d2cad41e7e17ced to your computer and use it in GitHub Desktop.

Select an option

Save Qyriad/c40965bc30add5821d2cad41e7e17ced to your computer and use it in GitHub Desktop.
Discount `dbg!()` in Bash
function what() {
echo -n "what $1: "
if declare -p "$1" > /dev/null 2>&1; then
declare -p "$1"
elif declare -F "$1" > /dev/null 2>&1; then
declare -F "$1"
elif type -t "$1" > /dev/null 2>&1; then
type -t "$1"
else
echo "string --" "$1"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment