Skip to content

Instantly share code, notes, and snippets.

@fanf2
Created August 17, 2016 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanf2/982811ac34a4ac146a3b7c9fcc729c84 to your computer and use it in GitHub Desktop.
Save fanf2/982811ac34a4ac146a3b7c9fcc729c84 to your computer and use it in GitHub Desktop.
A Gnu info viewer based on cat and less
#!/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