Skip to content

tesujimath/bash-env-fish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

bash-env-fish

  • import Bash environment into Fish shell
  • extract Bash style shell variables from source files like /etc/os-release

Installation

May be installed from this repo using Fisher.

Dependencies

The heavy lifting is done by bash-env-json which must be separately installed and added to the path.

Notwithstanding the recommendation to use Python rather than jq for reading JSON in completion scripts, bash-env-fish does in fact use jq simply because it is so much lighter than Python. With apologies to the Fish developers.

(Note that jq is also a dependency of bash-env-json, so this is not imposing further burden.)

Example Usage

> echo 'export A=1; export B=2; export Z=101' | bash-env
> echo $A $B $Z
1 2 101

> cat abc.env
export A=101
export B=102
export C="fooled ya!"

> bash-env abc.env
> echo $A $B $C
101 102 fooled ya!

> ssh-agent | bash-env
Agent pid 921717
> echo $SSH_AUTH_SOCK
/tmp/ssh-XXXXXXI4IoXr/agent.921715

> bash-env /etc/os-release
> echo $PRETTY_NAME
NixOS 24.11 (Vicuna)
> fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
> echo $PRETTY_NAME
<no output>

History

This approach for Bash environment support for non-POSIX shells was pioneered in bash-env-nushell for Nushell. The Bash backend was extracted as the common dependency bash-env-json when adding similar support in bash-env-elvish for Elvish. And now for Fish.

Alternatives

See also

About

Bash environment support for Fish shell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages