From: Oleg Broytman Date: Wed, 1 Mar 2017 21:17:34 +0000 (+0300) Subject: bin/PS: pass option '-S' to 'less' X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=b2bb82588785872e2e5e644ab42fc43b6e8bbf53;p=dotfiles.git bin/PS: pass option '-S' to 'less' --- diff --git a/bin/PS b/bin/PS index db86d2b..67574b5 100755 --- a/bin/PS +++ b/bin/PS @@ -7,4 +7,11 @@ if "--sort=" not in args: args += " --sort=user" pager = os.environ.get("PAGER", "more") +# if pager is 'less', option '-S' must be passed to it +if pager == 'less': + less = os.environ.get("LESS") or '' + opt = 'S' + if opt not in less: + less = opt + less + os.environ["LESS"] = less os.system("ps %s | %s" % (args, pager))