Skip to content

Instantly share code, notes, and snippets.

@tmlbl
Created June 28, 2018 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmlbl/4c76b63ff09d7ad2ddee35542776a6d2 to your computer and use it in GitHub Desktop.
Save tmlbl/4c76b63ff09d7ad2ddee35542776a6d2 to your computer and use it in GitHub Desktop.
Simple script to print out files from a Debian package that fall within the current user's $PATH
#!/bin/bash
# A simple script for listing the files from a Debian package that fall within
# the current user's $PATH
dfiles=$(dpkg -L $1)
if [ ! "$dfiles" ]; then
exit 1
fi
while read -r file; do
dir=$(dirname $file)
for path in ${PATH//:/ }; do
if [ "$dir" = "$path" ]; then
echo $file
fi
done
done <<< "$dfiles"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment