0
0

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.

[Linux] 区切り文字を変更する (IFS)

Last updated at Posted at 2019-10-03

IFS (Internal Filed Separator)

区切り文字を変更する

#!/bin/bash

OLD_IFS="$IFS"
IFS=$'\n'
...
IFS="$OLD_IFS"

区切り文字の指定例

IFS=$' \t\n' # スペース, タブ, 改行 (default)
IFS=$','
IFS=$'-'
IFS=$':'
IFS=$';'
IFS=$'' # 未指定も可能

IFSの情報をダンプする

# macOS(10.14.5) の IFS情報
$ echo -n "$IFS" | od -b
0000000   040 011 012                                                    
0000003
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?