https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193759
Bug ID: 193759 Summary: Wrong behaviour of IFS='|' set in /bin/sh Product: Base System Version: 10.0-RELEASE Hardware: Any OS: Any Status: Needs Triage Severity: Affects Only Me Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: michip...@gmail.com Using IFS to set positional parameters as in IFS='|' set -- $line displays erratic behaviour. In the script below, the expected output is A-1-2 B-1-2 C-1-2 but the first splitting is handled specially and we get A|1|2-- B-1-2 C-1-2 ----8<---- mock() { cat <<EOF A|1|2 B|1|2 C|1|2 EOF } demonstrate() { while read line; do IFS='|' set -- $line printf '%s-%s-%s\n' "$1" "$2" "$3" done } mock | demonstrate ---->8---- Note that splitting twice fixes the output. ----8<---- demonstrate2() { while read line; do # The following line has been intentionally duplicated IFS='|' set -- $line IFS='|' set -- $line printf '%s-%s-%s\n' "$1" "$2" "$3" done } mock | demonstrate2 ---->8---- -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"