Hi,

(this is a copy, without 'Re:' tag, so everybody interested can get it)

I've got a function, which allows to source bash/tcsh source files from within fish.
All it can do is to update exported variables.
In normal mode it runs the foreign shell, sources the file, makes the 'diff' of
'env' output and updates the changed variables in fish.

It can be used in the following way:
source file.sh
source file.csh
or
source file.tcsh

If file has no extension, one should specify the file format manually
source --sh sourcefile
source --csh sourcefile
source --bash sourcefile

There is also another mode, triggered by --ext option:
source --ext sourcefile.sh
Instead of making 'diff' of the exported environment, it makes 'exec sh'
to start the foreign shell, sources the file, and 'exec fish' to get the fish again with new exported variables. When this method is used, all local variables and
unsaved functions are lost. So it's less preferable.

Concerning the keychain example. If it outputs the code to be sourced, it can be used in the following way:
source --sh (keychain --eval id_rsa 52B5C810 | psub)

See the function in the attachments.

regards,
Maxim

Attachment: source.fish
Description: Binary data

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to