如何在LESS环境变量中设置-R?


Answers:


15

摘自联机帮助页:

Options are also taken from the environment variable "LESS".  
For example, to avoid  typing  "less  -options  ..."
each time less is invoked, 

you might tell csh:

   setenv LESS "-options"

or if you use sh:

   LESS="-options"; export LESS

如果您使用的是Bash,这是各种发行版的默认设置,那么我们可以这样做:

export LESS="-R"

如果要使此操作在shell /登录会话中永久存在,则需要将以上命令添加到适当的文件中,再次以Bash为例,使用文本编辑器打开$ HOME / .bashrc并拖放在导出命令中。这意味着每次Bash调用它都会运行export命令,并设置您的Less首选项。

希望有帮助:-)


LESS环境变量也可以在Less to Windows的Unxtools端口中使用。
理查德
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.