help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] feature request: source a script with executing anything


From: Greg Wooledge
Subject: Re: [Help-bash] feature request: source a script with executing anything
Date: Wed, 25 Jul 2018 08:02:40 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Wed, Jul 25, 2018 at 10:44:00AM +0000, Patrick Schleizer wrote:
> I would like to have a feature to tell bash "source --no-exec
> /usr/bin/xdg-open" or so which ignores all commands outside of shell
> functions and just imports the shell functions from /usr/bin/xdg-open.

It wouldn't really work.  Bash functions are not always "pure" standalone
things that can be used in isolation.

Just *one* example: the parser must be told, in advance, whether the
function definition will need to be parsed with extglob turned on.  So,
not only would you need to "source" the function definition, but also
any prior shopt commands.

And then, what if the shopt command has a list of options stored in an
array variable?  You'd need the code that sets that array variable.

And so on.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]