Isaac Dupree wrote:
> now, if only there were a good way to call back into fish from commands, 
> e.g.
> 
> set FOOL foo
> #imaginary parenthesis syntax to create a command not a string:
> env FOOL=bar (echo 3; cd $FOOL; set FOOL $FOOL)
> #where does the "3" go to?  Are we in the "bar" directory now?
> #Does FOOL have its prior value, or "bar"?
> #Fish hates the idea of subshells, remember...
> sudo (cat $FOOL > /sys/wherever)
> 
> But I fear issues of variable scoping (environmental, cwd...) and pipes 
> (stdout,stderr...) might make that too unintuitive no matter how it's done.
> 
> (if we did, we could perhaps just make more commands that didn't have to 
> be part of the shell)

# Maybe we could do it like
function to_export
   echo 3; cd $FOOL; set FOOL $FOOL
end
set cmd (convert_to_command to_export)
#where convert_to_command is a builtin, and the only thing I wonder is
# how long the created script lasts.  And whether that technique would
# work satisfactorily in the presence of something like chroot.
# Maybe /dev/fd/something, except that pipes can't be executed even if
# they begin with #! .
env FOOL=bar $cmd
#or even, use it like "begin" or something
env FOOL=bar (convert_to_command; echo 3; cd $FOOL; set FOOL $FOOL; end)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to