8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Fish Shell で、文字列内でサブコマンドの結果を展開

Posted at

Fish は便利なんだけど、ところどころ互換性が無くて、Bash/Zsh前提に作られているチュートリアルで困る。

Fish Shell では文字列内でサブコマンドの結果を展開することができない。

やりたいこと

bash
curl -L "https://hoge.com/docker-compose-$(uname -s)-$(uname -m)" \
    -o /usr/local/bin/docker-compose

方法1

予め変数に入れる

set uname_s (uname -s)
set uname_m (uname -m)
curl -L "https://hoge.com/docker-compose-$uname_s-$uname_m" \
    -o /usr/local/bin/docker-compose

方法2

つなげる

curl -L "https://hoge.com/docker-compose-"(uname -s)"-"(uname -m) \
    -o /usr/local/bin/docker-compose

方法3

Fishを諦めてBashにする

bash -c 'curl -L "https://hoge.com/docker-compose-$(uname -s)-$(uname -m)" \
    -o /usr/local/bin/docker-compose'
8
5
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?