← 返回命令列表

Linux command

ifs 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Set field separator

IFS=':' read -ra arr <<< "a:b:c"

Split on newline

IFS=$'\n'

Save and restore IFS

OLD_IFS="$IFS"; IFS=','; ...; IFS="$OLD_IFS"

Default IFS

IFS=$' \t\n'

说明

IFS (Internal Field Separator) is a shell variable controlling word splitting. It defines characters used to split strings into fields. The default IFS is space, tab, and newline. Changing IFS affects read, for loops, and word splitting behavior.

参数

IFS
Internal Field Separator variable.

FAQ

What is the ifs command used for?

IFS (Internal Field Separator) is a shell variable controlling word splitting. It defines characters used to split strings into fields. The default IFS is space, tab, and newline. Changing IFS affects read, for loops, and word splitting behavior.

How do I run a basic ifs example?

Run `IFS=':' read -ra arr <<< "a:b:c"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does IFS do in ifs?

Internal Field Separator variable.