On Sun, Sep 24, 2017 at 4:44 PM, Mark Volkmann <r.mark.volkm...@gmail.com>
wrote:
> I see that can enter a command name (referring to an executable script
> file in PATH) followed by & to run it in the background, but the same
> doesn't seem to work with function names. Is there a reason why those are
> treated differently?
>
Mostly because doing so is ill-defined and can result in unexpected
results. If the function modifies the state of the shell running it in the
background (i.e., like an external command) would mean it cannot do so.
Create the following function in bash (or zsh, etc.). Then type `x=abc; x;
echo $x`. Then type `x=abc`, `x&`, then `echo $x`. Notice the difference?
x() {
x=def
}
The only way to do this sensibly is to simulate running it in the
background by running it in a separate thread. There's an open issue
discussing this. Someone just needs to write the code to implement the idea
:-)
--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users