Skip to content

Instantly share code, notes, and snippets.

@skwid138
Last active March 8, 2025 17:46
Show Gist options
  • Save skwid138/8b8de484483f092bb917f07dd0ee6fb0 to your computer and use it in GitHub Desktop.
Save skwid138/8b8de484483f092bb917f07dd0ee6fb0 to your computer and use it in GitHub Desktop.
Simple Functions
#!/bin/bash
## Count all files including hidden in a given directory
countf() {
ls -lAR "$1" | grep '^-' | wc -l
}
## Count all non-hidden files in a given directory
countf_a() {
ls -lR \$1 | grep '^-' | wc -l
}
## Debug key codes
key_debug() {
echo "Press any key combination to see its code (Ctrl+C to exit)"
while true; do
read -k 1
echo -n "$REPLY" | hexdump -C
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment