LoginSignup
4
4

More than 5 years have passed since last update.

bashでIFS等の変数を変更する場合、こうすると良いのでは?

Last updated at Posted at 2016-01-18

と、ふと思ったのでメモ。

▼ 改善前

# バックアップ
$ IFS_BACKUP="$IFS"

# IFS変更
$ IFS=$’\n'

…(処理)…

# IFSを元に戻す
$ IFS="$IFS_BACKUP"

# IFS_BACKUP変数を削除
$ unset IFS_BACKUP

▼ 改善後

(
# IFS変更
$ IFS=$’\n'

…(処理)…

)
4
4
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
4
4