14
12

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.

冪等性を考慮してファイルに文字列を追加するシェルスクリプト

Posted at
  • /home/vagrant/.bashrc に環境構築PHP_IDE_CONFIGを設定したい
  • Vagrant で実行するプロビジョニングに記載するので、冪等性を持ちたい

grep して値が無ければ、追記する。

$ grep -q PHP_IDE_CONFIG /home/vagrant/.bashrc || echo 'export PHP_IDE_CONFIG="serverName=xxx.xxx.xxx.xxx"' >> /home/vagrant/.bashrc
14
12
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
14
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?