LoginSignup
1
0

More than 5 years have passed since last update.

ShellScript note #bash #zsh

Last updated at Posted at 2018-05-24

コマンドの返り値を変数に代入する方法

branch=$(git symbolic-ref --short HEAD)

if [ ${branch} = 'master' ]; then
  echo 'master'
elif [ ${branch} = 'develop' ]; then
  echo 'develop'
else
  echo 'other branch'
fi

ヒント: http://sweng.web.fc2.com/ja/program/bash/bash-store-command-result.html

1
0
0

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
1
0