Cat.which.sh script
February 26, 2026
A quick way to view the source of any script in your PATH.
Create /usr/src/scripts.d/local-shell2/cat.which.sh:
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit 1
fi
cat "$(which $1)"
exit 0
Enable bash completion and make executable:
echo "complete -c cat.which.sh" > /etc/bash_completion.d/cat-which.sh
chmod 755 /usr/src/scripts.d/local-shell2/cat.which.sh
Now try it out:
cat.which.sh kernel[tab]
kernel-config kernel-config-search.sh kernel.sh