Created
June 28, 2018 00:42
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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