Hi

Here's an alternate version that doesn't use temporary files, but does use
python.

Usage:

```
./source_compat.py source <script file here> | .
```

Note, in your example, you need to source the file, and then call a
function from that file.  This is also possible:

```
./source_compat.py 'source ./chruby.sh; chruby_use' | .
```

Thanks

Steve

On Mon, May 13, 2013 at 1:36 PM, Maxim Gonchar <gma...@gmail.com> wrote:

> Hi,
>
> I have a script which is doing what you suggested:
> source env.sh
> source env.csh
> source env.csh
>
> If a file lacks extension you can use options --sh, --bash and --csh.
> If you use --ext it works in a bit different way: it execs a foreign shell
> which sources a file and then execs fish again.
>
> It was stable, but be careful, it can corrupt current environment if it
> fails.
>
> regards,
> Maxim
>
>
> On Mon, 13 May 2013 15:52:30 +0400, Michael Stillwell <m...@beebo.org>
> wrote:
>
>  Is there any way to run bash/zsh scripts that set environment
>> variables under fish?  I was hoping there'd be a function that did
>> something like:
>>
>> 1. Run printenv under fish, capture the output.
>> 2. Run the script under bash, capture the output of printenv.
>> 3. Diff the two printenv outputs, and run set commands within fish as
>> appropriate.
>>
>> The script I'm especially trying to get working with fish at the moment is
>>
>> https://github.com/postmodern/**chruby/blob/master/share/**
>> chruby/chruby.sh<https://github.com/postmodern/chruby/blob/master/share/chruby/chruby.sh>
>>
>> but it's a somewhat general problem.
>>
>>
>>
>>
>> Cheers,
>> Michael
>>
>> ------------------------------**------------------------------**
>> ------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! 
>> http://p.sf.net/sfu/neotech_**d2d_may<http://p.sf.net/sfu/neotech_d2d_may>
>> ______________________________**_________________
>> Fish-users mailing list
>> Fish-users@lists.sourceforge.**net <Fish-users@lists.sourceforge.net>
>> https://lists.sourceforge.net/**lists/listinfo/fish-users<https://lists.sourceforge.net/lists/listinfo/fish-users>
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
>

Attachment: source_compat.py
Description: Binary data

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to