You are not logged in.

#1 2018-01-30 19:44:05

qcgxr
Member
Registered: 2016-08-31
Posts: 29

Bash 'quick help' function

Toward perfecting my laziness,

Add to bashrc:

function qh () (
    function qh1 () {
      out="$(help "$1" 2>&1 )"
      [ $? -ne 0 ] && return 1
      echo "$out"
    }

    type -all "$1" ; { qh1 "$1" || "$1" --help 2>/dev/null || man "$1" 2>/dev/null ;} | egrep -i -- "$2"
)

For quick help, run

qh foo bar

in order to search foo's help for bar. Equivalent to

foo --help | grep bar

.

Stolen from: https://unix.stackexchange.com/question … se-in-bash

Offline

Board footer

Powered by FluxBB