On Mon, 18 Apr 2016 16:42:56 +0200 Marko =?ISO-8859-1?Q?Cupa=3F?= 
<marko.cu...@mimar.rs> wrote:
> Hi,
> 
> in tcsh on FreeBSD, I use the following line in .tcshrc in order to
> start xfce when looging on ttyv3:
> 
> if  ($tty == ttyv3) then
>   startxfce4 --with-ck-launch
>   logout
> endif
> 
> How can I achieve the same with OpenBSD's default ksh and .kshrc?
> 
> Thank you in advance,
> --
> Before enlightenment - chop wood, draw water.
> After  enlightenment - chop wood, draw water.
> 
> Marko Cupać
> https://www.mimar.rs/
> 

it's been more years than i can count since i've used either tcsh or FreeBSD,
but if you are trying to detect the current tty (which is what i am assuming
is what is in $tty), you can use ps (the variable '$$' is a reference to the
current shell's pid):

$ ps -o pid,tt | sed -n "s/^$$ //p"
p3

now i don't know what v3 is, but the console ttys are ttyC? on OpenBSD, so
if you want only the first window at the console,

  if [[ $(ps -o pid,tt | sed -n "s/^$$ //p") = C0 ]];then
    startxfce4 --with-ck-launch
    exit
  fi

should do the trick. i also assume that 'logout' exits the shell, and thus
logs you out, hence logout -> exit, which will exit the script (or in this
case the shell since it's in the startup script).

Reply via email to