I would like my tcsh script to launch an editor (e.g., vi, emacs):
#!/bin/tcsh vi my_file
This starts up vi with my_file but first displays a w
Set your terminal tty to a variable, and then redirect the editor i/o through that variable.
tty
In your script:
#!/bin/sh ls | while read a; do vi $a < $MYTTY >$MYTTY; done
And then execute the script with:
$ MYTTY=`tty` ./myscript >/tmp/log