On 10/23/26 12:50, Janis Papanagnou wrote:
> On 2026-10-21 00:54, Helmut Waitzmann wrote:
>> Janis Papanagnou <jani…@hotmail.com>:
>>> On 2026-10-17 22:47, Lawrence D’Oliveiro wrote: >>> I've just done this ("a script change while it's running") [*] >>> >>> [*] What I've done was to run the following script "dynchg.sh" >>> >>>    while read ; do >>>        echo $REPLY >>>    done >>> >>> and change it (from another terminal) while it runs by >>> >>>    sed -i '2p' dynchg.sh >>>
>> >> As the "-i" option is not defined by the POSIX standard but by GNU sed, I assume that your example uses GNU sed.
> > Yes. (I've just used '-i' for simplicity.) > > A better example would have been to issue (from another shell window) > the command > >    echo "echo END" >> dynchg.sh > > and we then see that after terminating the above loop the "END" will > be printed. > > (I'm testing with ksh but suppose that in bash it would be similar.)
KSH and BASH are "mostly compatible". Minor diffs but nothing hard to get around. Anything you can do in KSH can be done in BASH. There are MANY shells, of course. CSH and ZSH are 'more different' for example and it'd be a more complicated translation. Not impossible, just more work. If KSH works for you then stick with it. Note however that MOST distros default to BASH now - so if you plan to 'distribute' your work it'd be better to move your stuff over to BASH. Most distros, users would have to intentionally install KSH and scripts would need a shebang at the top to specify which shell to use. (good practice, always add the shebang)