1

I had set less to a vim less functionality some years ago and I would like to reverse those changes. Therefore I started removing the alias from "~/.zshrc". Since after sourcing this file my system told me that when I type "less" I wanted to access the vim less functionality I added those two exports:

export LESSOPEN="|lesspipe.sh %s"
export LESS="/usr/bin/less"

and the following alias

alias less="/usr/bin/less"

"ls -l \less" did not present me the target of the default target of less so I couldn't see what the actual default symbolic link of less targeted

After sourcing the file everything works fine except for the fact that I will now receive the line "There is no -/ option ("less --help" for help)".

How can I fix this problem, why does it even appear?

1 Answer 1

2

In less man page:

ENVIRONMENT VARIABLES

LESS: Options which are passed to less automatically.

The point of the environment variable is to configure default options for less. You could do:

export LESS=FRX

for instance for the -F, -R and -X options to be passed automatically.

So you don't want to put a path to a less executable in there. Doing so would tell less to try and interpret it as options. / is not a valid option name for less.

Also, the alias less=/usr/bin/less should only be necessary if there are more than one less versions installed on the system and it's the one in /usr/bin you want as opposed to the one that would be found via a $PATH lookup.

Even then, using an alias is not necessary there, you could use hash less=/usr/bin/less instead to tell the shell the preferred path to the less command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.