You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
462 B
Bash

#!/bin/sh
#
# Copyright (C) 2017-2019 Hamish Coleman
#
# 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+//'