Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: a way to get the value of the -c option



03.12.2015, 14:55, "Vincent Lefevre" <vincent@xxxxxxxxxx>:
> zsh should provide a way to get the value of the -c option. Under
> Linux, one can look at /proc/$$/cmdline, but I think that it would
> be better to get this information in an OS-independent way.
>
> This would be useful for .zshenv to know the context, for instance, as
> a user of OpenSSH, to know whether this is a shell used for ~/.ssh/rc
> (the -c value is '/bin/sh .ssh/rc' in this case). When $DISPLAY is
> set, I set up a part of my X11 environment from .zshenv, and this
> includes an execution of xdpyinfo, but before the ~/.ssh/rc script is
> executed, the xauth authorization hasn't been added yet, so that I get
> an annoying error message. So, the idea is to disable this set up for
> this -c value.

This is good idea: I personally have a few `exec` calls in my zshrc (basically they do two things: launch shell in dtach if it is not already in tmux/dtach/screen and use `hilite` program if it was not already used), but by doing this I loose the possibility to use `zsh -ic`. Presence of the variable which contains `-c` argument will fix this problem.

>
> --
> Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Messages sorted by: Reverse Date, Date, Thread, Author