thinkpad-ec/scripts/describe
2018-10-25 16:18:40 +01:00

24 lines
419 B
Bash
Executable File

#!/bin/sh
#
# Look up the given filename in the description file and output the
# text description
#
# FIXME
# - the description file is expected to be in the current dir
DESCRIPTIONS=Descriptions.txt
FILE="$1"
if [ -z "$1" ]; then
echo need filename
exit 1
fi
if ! LINE=$(grep -E "^$FILE " "$DESCRIPTIONS"); then
echo "Unknown file $FILE"
exit 1
fi
echo "$LINE" | perl -pe 's/^(\S+)\s+(\S+)\s+//'