Op 23-02-2023 om 03:42 schreef Jeffery Small:
You could trap a signal for that, e.g. SIGUSR1 or SIGUSR2 which are
meant to have a user-defined purpose.
In general, to reinitialise the shell, you can do:
exec -a-ksh ksh
which will replace ksh by itself with a $0 of '-ksh'; the initial -
makes it act like a login shell. (Use a simple 'exec ksh' if that is not
wanted.) This assumes the ksh you're running is the default ksh in
$PATH. Adjust the command as necessary.
To reinitialise the shell upon receiving SIGUSR1, add this to ~/.kshrc:
trap 'exec -a-ksh ksh' USR1
Then to reinitialise all your shells on the same machine, run:
killall -USR1 ksh
Note: that command will terminate ksh sessions that do not have this
trap set.
To do this on a remote machine, run the killall command remotely via ssh.
Hope this helps (even though this response comes months later).
--
|| modernish -- harness the shell
||
https://github.com/modernish/modernish
||
|| KornShell lives!
||
https://github.com/ksh93/ksh