Hi,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 On Wed, 13 Jun 2012 13:08:32 +0400, pants <pa...@cs.hmc.edu> wrote:
keychain does not actually run the set commands. All it does is print those strings to stout. You need to either set up something to eval each of them or parse them and run set on each of their arguments. As it is set up right now in your config.fish, you are simply echoing the strings and not evaluating them. pants. On Wed, Jun 13, 2012 at 10:55:40AM +0200, Gour wrote:Hello! In my zsh setup I use keychain to start ssg & gpg agents automatically, but have problems using it under fish. I put the following in my config.fish: keychain --eval id_rsa 52B5C810 set fish as default shell and upon launching XFCE I get dialogs to enter passwords. Moreover, keychain lists the running agents: gour@atmarama ~> keychain --agents * keychain 2.7.1 ~ http://www.funtoo.org * Found existing ssh-agent: 4212 * Found existing gpg-agent: 4238 However, the problem is that trying to ssh to some remote server, I'm asked for a passphrase. Here is the ps ax output: gour@atmarama ~> ps ax | grep ssh 4212 ? Ss 0:00 ssh-agent 4413 ? Ss 0:00 /usr/bin/gpg-agent --sh --daemon --enable-ssh-support --write-env-file /home/gour/.cache/gpg-agent-info Moreover, ssh does not report any identity: gour@atmarama ~> ssh-add -l The agent has no identities. My ~/.keychain/domain-fish has the following content: set -e SSH_AUTH_SOCK; and set -x -U SSH_AUTH_SOCK /tmp/ssh-0F3yvROn3IrT/agent.4211 set -e SSH_AGENT_PID; and set -x -U SSH_AGENT_PID 4212 but, as seen, above, ssh-add shows no identity. Here is ~/.keychain/domain-sh output: SSH_AUTH_SOCK=/tmp/ssh-0F3yvROn3IrT/agent.4211; export SSH_AUTH_SOCK; SSH_AGENT_PID=4212; export SSH_AGENT_PID; If I logout/login with zsh as default shell, the same agents are still running and ssh-add -l shows my RSA identity and I can log to the remote server without typing password. Any clue what's wrong? Sincerely, Gour -- Even a man of knowledge acts according to his own nature, for everyone follows the nature he has acquired from the three modes. What can repression accomplish? http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security andthreat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malwarethreats. 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------------------------------------------------------------------------------ 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
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