On Thu, Sep 28, 2006 at 07:34:08PM -0400, Philip Ganchev wrote:
> >except that this is not enough to cover the whole range of legal sh or
> >csh syntax that we could possibly be subjected with here.
> >(the value could be in "" instead of '', and i have no idea what else)
> So we have to look at the source code of dbus-launch to find out the
> syntax of its output.

i am not talking about dbus-launch but any program out there that could
make use of this technique. that program may not even have been written.

all we can assume pretty much is that the output will be sh or csh compatible.

> >and for that reason i don't want to play games with regexps but am
> >hoping there is a way to come up with a more reliable solution.
> How else, if not with regexps?

the only way that will be 100% reliable is to implement a full posix
compatible parser. this of course is way to much for fish, however, this
parser would not need to be part of fish. it could be an external
program. 

all that is really needed is a a way to change a fish environment using
an sh script. perhaps this can be done by running the script in plain
sh, and then examining the resulting environment within that sh process,
and copy the changes over to the fish environment.

sh-eval:
#!/bin/sh
eval $*
fish -c set
#---

the above wrapped into a function that does the equivalent of:
making a snapshot of the environment.
run sh-eval
comparing the previously saved environment with the output produced by
the script.
setting the changed variables in the outer environment.

unless i miss something, this should cover most cases while avoiding the
need to parse sh syntax.

greetings, martin.
-- 
cooperative communication with sTeam      -     caudium, pike, roxen and unix
offering: programming, training and administration   -  anywhere in the world
--
pike programmer   travelling and working in europe             open-steam.org
unix system-      bahai.or.at                        iaeste.(tuwien.ac|or).at
administrator     (caudium|gotpike).org                          is.schon.org
Martin Bähr       http://www.iaeste.or.at/~mbaehr/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to