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

Re: Making a script 'sourceable'



DervishD <disposable1@xxxxxxxxxxxxxx> writes:

> [ ... ]
>
>     So I must, by hand, restore any changed variables, options and,
> what more? Must I restore any other thing? Is there any simple way of
> making scripts source-safe or source-aware?
>
>     Thanks a lot in advance :)
>
>     Raúl Núñez de Arenas Coronado

¡Hola Raúl!  Espero que te encuentres muy bien.

I'm not sure if this handles the case that you're concerned about, but
when I want to make a script "sourceable" as well as executable, I do
this:

  #!/bin/zsh
  (
    # all script stuff goes here
  )

Yes, it causes an extra fork, but that's the price I pay for this dual
sourceable/executable capability.


-- 
 Lloyd Zusman
 ljz@xxxxxxxxxx
 God bless you.



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