Hi all,

Further simplification - 'ps | grep' can be replaced by pgrep(1)
and if-then-fi by &&.

> While there:
> 
> - remove ':' (null utility) from the very first line of the file -
>   I *do* understand what it does but it doesn't seem like it's needed
>   at all, unless I'm missing something (as is the case with some idioms)
> [...]
> 

As it transpired, this does indeed seem to be an old idiom denoting
a Bourne shell script.

To quote rpe@: "I guess it's fine to remove the : line in 2017."

I agree.

Thanks again to Robert for all the feedback and suggestions.

Regards,

Raf

Index: etc/ksh.kshrc
===================================================================
RCS file: /cvs/src/etc/ksh.kshrc,v
retrieving revision 1.28
diff -u -p -r1.28 ksh.kshrc
--- etc/ksh.kshrc       15 Jul 2017 07:11:42 -0000      1.28
+++ etc/ksh.kshrc       16 Jul 2017 11:49:55 -0000
@@ -1,4 +1,3 @@
-:
 #      $OpenBSD: ksh.kshrc,v 1.28 2017/07/15 07:11:42 tb Exp $
 #
 # NAME:
@@ -74,9 +73,7 @@ case "$-" in
        xterm*)
                ILS='\033]1;'; ILE='\007'
                WLS='\033]2;'; WLE='\007'
-               if ps -p $PPID -o command | grep -q telnet; then
-                       export TERM=xterms
-               fi
+               pgrep -qxs $PPID telnet && export TERM=xterms
                ;;
        *)      ;;
        esac

Reply via email to