Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Read/write multiple histories from non-interactive shell



On Mon, Feb 13, 2023 at 9:57 AM OG Code Poet <ogcodepoet@xxxxxxxxx> wrote:
>
> My larger script misbehaves and exits with 0 before it could
> complete if I replace #!/usr/bin/env zsh with #!/usr/bin/env -S zsh
> -fi or #!/usr/bin/env -S zsh -i.

You might want to try to figure out why.

> Is there a restriction on starting any existing functional zsh
> program with -fi? Put another way, are all non-interactive shell
> scripts guaranteed to function when shebang is changed to
> #!/usr/bin/env -S zsh -fi??

If you put something like this in a script, it won't work the same way
in interactive shell:

    [[ -o interactive ]] && exit

In general, if your script needs interactive features, it makes
perfect sense to use an interactive shell as the interpreter.

Roman.




Messages sorted by: Reverse Date, Date, Thread, Author