> Nicholas Burlett wrote:
> > I'm attempting to convert a bash idom into fish, and I can't quite
> > figure out a clean way to do it. In bash, I sometimes used:
> >
> > (cd /home/path/to/checkout ; svn diff checkout/path/file.c) | patch -p0
> >
> > The closest I can come to this in fish is:
> >
> > begin pushd /home/path/to/checkout ; svn diff checkout/path/file.c;
> > popd; end | patch -p0
> >
I use pushd/popd too but that's bad because if the sequence aborts
(because of some error or because I kill it), fish is left in the
wrong dir.
2008/5/20, Isaac Dupree <[EMAIL PROTECTED]>:
> do I recall a `cd --local/-l` ? was that ever figured out and
> implemented? then it could be
> begin cd -l /home/path/to/checkout ; svn diff checkout/path/file.c
> ; end | patch -p0
>
Nice idea, but defining the scope of cd locality seems a bit tricky.
E.g. currently "begin; ...; end" is equivalent to "if true; ...; end".
So should "cd -l" also be local to "if"? To any construct delimited by "end"?
This is not always desired - consider::
begin
if COND
cd SOME-DIR
else
cd OTHER-DIR
end
DO-SOMETHING-IN-DIR
end
where the "cd" should not be local to the "if" but should be local to
the "begin".
This is just an example. I'm not sure it proves anything, but I fear
there is no single clean and useful definition for the scope for "cd
-l"...
Alternative proposal: a new "saved [DIR]; ...; end" construct that
explicitly saves and restores the working directory in that block
(temporarily changing to DIR if given).
Alternative 2 (half-baked): some kind of "try..finally..end" construct
to ensure the execution of things like "popd"?
--
Beni Cherniavsky <[EMAIL PROTECTED]> (I read email only on weekends)
-------------------------------------------------------------------------
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