Last active
August 28, 2016 19:30
-
-
Save texadactyl/4d841712580ce47f9f2d to your computer and use it in GitHub Desktop.
Given an installed Ubuntu file, what Ubuntu package does the file belong to?
This file contains 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
MYSELF=`basename $0` | |
ARG=$1 | |
ARGC=$# | |
if [ $ARGC -lt 1 ] || [ -z $ARG ]; then | |
echo | |
echo -e "\tUsage:\t"$MYSELF"\t{Installed File(s)}" | |
echo | |
exit 86 | |
fi | |
for ARG in $*; do | |
dpkg -S "$(readlink -fn "$(which $ARG)")" | |
done | |
exit 0 | |
#################################################### | |
# Example: | |
# file2pkg.sh ls | |
# Standard output: | |
# coreutils: /bin/ls | |
# For this example, | |
# coreutils is the derived package name. | |
# /bin/ls is the full path of the argument file. | |
#################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment