You are not logged in.

#1 2017-01-25 13:59:23

pensnarik
Member
Registered: 2014-02-16
Posts: 13

[solved] man terminates with error when tries to open some man pages

[mutex@asus]$ (master)*$ man man
sed: can't read 2>/dev/null: No such file or directory
sed: can't read |: No such file or directory
sed: can't read less: No such file or directory
man: command exited with status 2: sed -e '/^[[:space:]]*$/{ N; /^[[:space:]]*\n[[:space:]]*$/D; }' | (cd <fd 3> && LESS=-ix8RmPm Manual page man(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$PM Manual page man(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$-iMSx4 -FXR MAN_PN=man(1) sed s/\([[:space:]]\+[0-9.\-]\+\)$/\1/;s/\([[:space:]]\+[0-9.\-]\+[[:space:]]\)/\1/g;s/|/|/g;s/^\([-+]\+\)/\1/ 2>/dev/null | less)

Last edited by pensnarik (2017-01-25 15:15:37)

Offline

#2 2017-01-25 14:19:36

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: [solved] man terminates with error when tries to open some man pages

Do you have "man" aliased somewhere? Are you using oh-my-zsh, or anything like it?

Offline

#3 2017-01-25 14:34:32

pensnarik
Member
Registered: 2014-02-16
Posts: 13

Re: [solved] man terminates with error when tries to open some man pages

2ManyDogs wrote:

Do you have "man" aliased somewhere? Are you using oh-my-zsh, or anything like it?

Oh, I found the problem. The problem was, I reexported PAGER and LESS variables in one function in .bashrc. Actually, psql command was redefined as function in ~/.bashrc.

psql() {
    YELLOW=$(printf "\e[1;33m" )
    LIGHT_CYAN=$(printf "\e[1;36m" )
    NOCOLOR=$(printf "\e[0m"    )
    RED=$(printf "\e[1;31m" )

    PAGER="sed \"s/\([[:space:]]\+[0-9.\-]\+\)$/${LIGHT_CYAN}\1$NOCOLOR/;"
    PAGER+="s/\([[:space:]]\+[0-9.\-]\+[[:space:]]\)/${LIGHT_CYAN}\1$NOCOLOR/g;"
    PAGER+="s/|/$YELLOW|$NOCOLOR/g;s/^\([-+]\+\)/$YELLOW\1$NOCOLOR/\" 2>/dev/null  | less"

    env psql "$@"
}

I have changed it to:

psql() {
    YELLOW=$(printf "\e[1;33m" )
    LIGHT_CYAN=$(printf "\e[1;36m" )
    NOCOLOR=$(printf "\e[0m"    )
    RED=$(printf "\e[1;31m" )

    #export LESS="-iMSx4 -FXR"

    PAGER="sed \"s/\([[:space:]]\+[0-9.\-]\+\)$/${LIGHT_CYAN}\1$NOCOLOR/;"
    PAGER+="s/\([[:space:]]\+[0-9.\-]\+[[:space:]]\)/${LIGHT_CYAN}\1$NOCOLOR/g;"
    PAGER+="s/|/$YELLOW|$NOCOLOR/g;s/^\([-+]\+\)/$YELLOW\1$NOCOLOR/\" 2>/dev/null  | less"
    #export PAGER

    PAGER=$PAGER LESS=$LESS env psql "$@"
}

Offline

#4 2017-01-25 14:46:02

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

Re: [solved] man terminates with error when tries to open some man pages

if it is solved, kindly mark this threa solved by editing your first post and prepending [solved] to the title

Offline

#5 2017-01-25 16:51:23

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: [solved] man terminates with error when tries to open some man pages

You could also use

psql() (
    ...
)

(note the parentheses instead of the curly braces)

This will run the code inside the function in a sub shell, so variable declarations and exports should not affect your running shell.


pkgs │ hacks │ cfg │ blag

Offline

#6 2017-01-27 20:54:17

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [solved] man terminates with error when tries to open some man pages

Or you could just use local variables, so they don't leak outside the function...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB