Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're not going to be able to modify the caller's shell because it's in a different process context. When child processes inherit your shell's variables, they're inheriting copies themselves.</p> <p>One thing you can do is to write a script that emits the correct commands for tcsh or sh based how it's invoked. If you're script is "setit" then do:</p> <pre><code>ln -s setit setit-sh </code></pre> <p>and</p> <pre><code>ln -s setit setit-csh </code></pre> <p>Now either directly or in an alias, you do this from sh</p> <pre><code>eval `setit-sh` </code></pre> <p>or this from csh</p> <pre><code>eval `setit-csh` </code></pre> <p>setit uses $0 to determine its output style.</p> <p>This is reminescent of how people use to get the TERM environment variable set.</p> <p>The advantage here is that setit is just written in whichever shell you like as in:</p> <pre><code>#!/bin/bash arg0=$0 arg0=${arg0##*/} for nv in \ NAME1=VALUE1 \ NAME2=VALUE2 do if [ x$arg0 = xsetit-sh ]; then echo 'export '$nv' ;' elif [ x$arg0 = xsetit-csh ]; then echo 'setenv '${nv%%=*}' '${nv##*=}' ;' fi done </code></pre> <p>with the symbolic links given above, and the eval of the backquoted expression, this has the desired result.</p> <p>To simplify invocation for csh, tcsh, or similar shells:</p> <pre><code>alias dosetit 'eval `setit-csh`' </code></pre> <p>or for sh, bash, and the like:</p> <pre><code>alias dosetit='eval `setit-sh`' </code></pre> <p>One nice thing about this is that you only have to maintain the list in one place. In theory you could even stick the list in a file and put <code>cat nvpairfilename</code> between "in" and "do".</p> <p>This is pretty much how login shell terminal settings used to be done: a script would output statments to be executed in the login shell. An alias would generally be used to make invocation simple, as in "tset vt100". As mentioned in another answer, there is also similar functionality in the INN UseNet news server.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload