X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=bin%2FPS;h=67574b554436acdc20ac245993d489be5183fd0c;hb=HEAD;hp=db86d2b1b6a1e0e5ea672089284de01d770a423a;hpb=f46bd4d41cc7f243bc8a321effee5200aa69e709;p=dotfiles.git diff --git a/bin/PS b/bin/PS index db86d2b..7fbd8b1 100755 --- a/bin/PS +++ b/bin/PS @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 import sys, os @@ -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))