問題
Ruby の bundle install 時に
RAILS_ENV=development なら bundle install --without development で
RAILS_ENV=production なら bundle install --without development:test みたいなことをやりたい
例えば
$ config_staging=hoge
$ config_production=fuga
$ target=staging
のとき、 config_${target} の中身の hoge を呼び出したい
解決策
eval を使う
$ echo "$(eval echo \${config_${target}})"
hoge
# or
$ config=\$config_${target}
$ echo $config
$config_staging
$ echo "$(eval echo $config)"
hoge