Created
August 17, 2016 13:40
-
-
Save fanf2/982811ac34a4ac146a3b7c9fcc729c84 to your computer and use it in GitHub Desktop.
A Gnu info viewer based on cat and less
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
#!/bin/sh | |
try() { | |
file=$1 | |
echo $file | |
if [ -f $file-1 -o -f $file-1.gz ] | |
then | |
# there must be a better way of doing this | |
gzip -fdc `ls -f1 $file-* | | |
sed -e 's/.*\.info-\([0-9]*\)/\1 &/' | | |
sort -n | | |
sed -e 's/[0-9]* //'` | | |
less | |
exit | |
elif [ -f $file -o -f $file.gz ] | |
then | |
less $file* | |
exit | |
fi | |
} | |
k=$1 | |
for top in usr usr/local opt | |
do | |
for sub in 'info' '*/info' '*/info/*' | |
do | |
for leaf in $k $k.info | |
do | |
try /$top/$sub/$leaf | |
done | |
done | |
done | |
echo "info for \"$1\" not found" 1>&2 | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment