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

Re: sourcing a sh file in zsh

[Moved to -workers]

On Jan 16,  7:39pm, Andrey Borzenkov wrote:
} > You'll probably need to do something like
} >
} >   emulate sh
} >   source bla.sh
} Given that most distributions have equivalence of /etc/profile.d, having 
} simple zsh way to do it (without scoping issues) would be nice.

I'm reluctant to suggest adding options to "source", but introducing an
alternate name ("zsource"?) might allow something like

  zsource -e sh file.sh

with the obvious meaning of "turn on sh emulation while sourcing" and
would otherwise behave like "source".  Might need a variant that has
the path-searching semantics of "." as well.

Another possibility would be to extend the "emulate" command into a
precommand modifier sort of thing, where arguments following the name
of the emulation are treated as a command to execute.  Perhaps require
another option to make this active, to avoid any compatibily issue.

  emulate -LRE sh source file.sh

(I can't decide whether the new option should be S(ource), X(ecute),
or E(val), nor whether it should be upper case.)

In this case the -c and -a options of "exec" might be included as well.

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