linux-tutorial/codes/shell/逻辑控制/使用嵌套循环并修改IFS.sh

16 lines
190 B
Bash

#!/usr/bin/env bash
#changing the IFS value
IFS.OLD=$IFS
IFS=$'\n'
for entry in `cat /etc/passwd`
do
echo "Values in $entry -"
IFS=:
for value in $entry
do
echo " $value"
done
done