What's the equivalent to ${var:-defaultvalue} in fish?

后端 未结 3 838
生来不讨喜
生来不讨喜 2021-01-15 06:26

Hello I am trying to translate my .bashrc to fish format almost done, mostly is clear on the documentation but this part is giving me a headache.. is so my gnupg works with

3条回答
  •  逝去的感伤
    2021-01-15 07:13

    You should not change your login shell until you have a much better understanding of fish syntax and behavior. For example, in fish the equivalent of $$ is %self or $fish_pid depending on which fish version you are using. You should always specify the version of the program you are having problems with.

    Assuming you're using fish 2.x that would be written as

    if not set -q gnupg_SSH_AUTH_SOCK_by
    or test $gnupg_SSH_AUTH_SOCK_by -ne %self
        set -gx SSH_AUTH_SOCK "/run/user/$UID/gnupg/S.gpg-agent.ssh"
    end
    

    Also, notice that there is no equal-sign between the var name and value in the set -x.

提交回复
热议问题