i think what you want is a modified ssam that reopens
the console.  the reason for this is to seperate the editing from
the command stream. something like (for plan 9, run once)

(...)

or for linux (untested)

> (...)

Thanks, that's exactly what I need. My idea is to use this inside
sam itself with '|', so that I can easily edit small parts of big
files.

Here is my working version for linux. The only important change is
that I had to replace your use of $tty to a loop that uses 'fuser'
to find the terminal owned by $pid.

Best,
Maurício

#!/home/mauricio/plan9/bin/9 rc

file = $HOME ^ '/tmp/eec-' ^ $pid

cat > $file
pts = `{for (i in /dev/pts/*)
  achou = `{fuser $i >[2]/dev/null | grep $pid} {
    if (test -n $"achou) echo $i}}

#Note: 's' is a script that translates to sam.
s $file <[0]$pts >[1]$pts

cat $file

rm $file


Reply via email to