# HG changeset patch # User Lucas Levrel # Date 1452967710 -3600 # Node ID ecb326507194f33d0b1488b4272b621bf63f23b6 # Parent 9fd160a21243d1bcb0c1261b8796cde73c991b64 man: no choice if only one matching section diff -r 9fd160a21243 -r ecb326507194 rootfs/usr/bin/man --- a/rootfs/usr/bin/man Thu Jan 14 12:33:17 2016 +0100 +++ b/rootfs/usr/bin/man Sat Jan 16 19:08:30 2016 +0100 @@ -134,9 +134,13 @@ SECTIONS=$(wget -q -O - http://linux.die.net/man/$LETTER.html | \ sed -n -r "s%.*href=\"(.)/$TOPIC\".*%\1%p") [ -n "$SECTIONS" ] || { _ 'No manual entry for %s' "$TOPIC"; exit 0;} - _n '%s found in the following sections:\n%s\nPlease choose one: ' "$TOPIC" \ - "$SECTIONS" - read SECTION + if [ $(printf '%s\n' "$SECTIONS"|wc -l) -eq 1 ]; then + SECTION=$SECTIONS + else + _n '%s found in the following sections:\n%s\nPlease choose one: ' \ + "$TOPIC" "$SECTIONS" + read SECTION + fi fi MANURL="http://linux.die.net/man/$SECTION/$TOPIC"