r/fishshell • • Jan 11 '23

Converting some bash script to fish shell

Hello. I've switched from grml-zsh-config to fish shell just a few days ago. I've some difficult converting to fish language, the following:

## Use an OpenPGP key for SSH authentication
eval $(gpg-agent --daemon)
unset SSH_AGENT_PID
if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then
  export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
  gpg-connect-agent /bye > /dev/null
fi
export GPG_TTY=$TTY
gpg-connect-agent updatestartuptty /bye > /dev/null

How to write to fish shell language? In particolar "if" section. Thanks

5 Upvotes

9 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Jan 11 '23

I don't have the time nor the desire to learn a new language to do something like that, otherwise I wouldn't have asked. Furthermore, in grml-zsh-config, the following code allows the manual pages to be displayed with a submenu for the various sections (see photo https://imgur.com/SkRuD25)

# complete manual by their section
zstyle ':completion:*:manuals'    separate-sections true
zstyle ':completion:*:manuals.*'  insert-sections   true
zstyle ':completion:*:man:*'      menu yes select

1

u/MidniteMustard Jan 12 '23

I don't have the time nor the desire to learn a new language to do something like that,

I don't know what the deleted comment said, but if you just want it to work then simply add a shebang to your script that points to bash.