Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Last active December 10, 2015 17:08
Show Gist options
  • Select an option

  • Save ormaaj/4465894 to your computer and use it in GitHub Desktop.

Select an option

Save ormaaj/4465894 to your computer and use it in GitHub Desktop.
IFS side-effects
#!/usr/bin/env bash
for sh in ~/doc/programs/bash43 {{b,d}a,po,{m,}k,z}sh bb; do
printf '%-8s' "${sh##*/}:"
"$sh" </dev/fd/0
done <<\EOF
${ZSH_VERSION+:} false && emulate sh
set -f -- a b c
unset -v IFS
printf '<%s> ' ${*}${IFS=}${*}${IFS:=-}"${*}"
echo
EOF
# vim: set fenc=utf-8 ff=unix ft=sh :
8/11/13 -- current versions:
bash43: <a> <b> <ca> <b> <c-a-b-c>
bash: <a> <b> <ca> <b> <c-a b c>
dash: <a b cabc> <a-b-c>
posh: <a> <b> <ca b c> <a-b-c>
mksh: <a> <b> <ca> <b> <c> <a-b-c>
ksh: <a> <b> <ca> <b> <c> <a b c>
zsh: <a> <b> <ca> <b> <c> <a-b-c>
bb: <a b cabc> <a-b-c>
---
old:
bash: <a> <b> <ca> <b> <c-a b c>
dash: <a b cabc> <a-b-c>
posh: <a> <b> <ca b c> <a-b-c>
mksh: <a> <b> <ca b c> <a-b-c>
ksh : <a> <b> <ca> <b> <c> <a b c>
zsh : <a> <b> <ca> <b> <c> <a-b-c>
bb : <a b cabc> <a-b-c>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment