Herbert Xu <[EMAIL PROTECTED]> writes: > > As I understood it, it allowed it to be called like "smallyes ''". > Which could've been achieved by simply replacing > > YES="${1:-y}" > > with > > YES="${1-y}"
Oh, that still fails the second part of the bug report (#115581) -- smallyes foo bar echoes "foo\nfoo\n..", not "foo bar\nfoo bar\n.." Fortunately, that isn't triggered by anything (yet). Do you want to rely on that? In fact, no combination of 1,*,@ and :-, - manages to work perfectly for all of bash, ash and zsh ;) Assuming install will use ash or bash, either *-y or @-y seems like a good pick. In the following, "y::foo bar:" is the expected result. [tv@tv ~]$ for shell in ash bash zsh; do export shell; $shell -c 'smallyes_xu() { YES="${1:-y}"; while true ; do echo "$YES" ; done; }; ( echo $shell; smallyes_xu |head -1; smallyes_xu ""|head -1; smallyes_xu foo bar|head -1 )|tr "\012" ":"'; echo; done ;echo ash:y:y:foo: bash:y:y:foo: zsh:y:y:foo: [tv@tv ~]$ for shell in ash bash zsh; do export shell; $shell -c 'smallyes_xu() { YES="${1-y}"; while true ; do echo "$YES" ; done; }; ( echo $shell; smallyes_xu |head -1; smallyes_xu ""|head -1; smallyes_xu foo bar|head -1 )|tr "\012" ":"'; echo; done ;echo ash:y::foo: bash:y::foo: zsh:y::foo: [tv@tv ~]$ for shell in ash bash zsh; do export shell; $shell -c 'smallyes_xu() { YES="${@:-y}"; while true ; do echo "$YES" ; done; }; ( echo $shell; smallyes_xu |head -1; smallyes_xu ""|head -1; smallyes_xu foo bar|head -1 )|tr "\012" ":"'; echo; done ;echo ash:y:y:foo bar: bash:y::foo bar: zsh:y::foo bar: [tv@tv ~]$ for shell in ash bash zsh; do export shell; $shell -c 'smallyes_xu() { YES="${@-y}"; while true ; do echo "$YES" ; done; }; ( echo $shell; smallyes_xu |head -1; smallyes_xu ""|head -1; smallyes_xu foo bar|head -1 )|tr "\012" ":"'; echo; done ;echo ash:y::foo bar: bash:y::foo bar: zsh:::foo bar: [tv@tv ~]$ for shell in ash bash zsh; do export shell; $shell -c 'smallyes_xu() { YES="${*:-y}"; while true ; do echo "$YES" ; done; }; ( echo $shell; smallyes_xu |head -1; smallyes_xu ""|head -1; smallyes_xu foo bar|head -1 )|tr "\012" ":"'; echo; done ;echo ash:y:y:foo bar: bash:y::foo bar: zsh:y:y:foo bar: [tv@tv ~]$ for shell in ash bash zsh; do export shell; $shell -c 'smallyes_xu() { YES="${*-y}"; while true ; do echo "$YES" ; done; }; ( echo $shell; smallyes_xu |head -1; smallyes_xu ""|head -1; smallyes_xu foo bar|head -1 )|tr "\012" ":"'; echo; done ;echo ash:y::foo bar: bash:y::foo bar: zsh:::foo bar: [tv@tv ~]$ Of course, my version works perfectly ;-) [tv@tv ~]$ for shell in ash bash zsh; do export shell; $shell -c 'smallyes_tv() { if [ "$#" = "0" ]; then YES=y; else YES="$*"; fi; while true; do echo "$YES"; done; }; ( echo $shell; smallyes_tv |head -1; smallyes_tv ""|head -1; smallyes_tv foo bar|head -1 )|tr "\012" ":"'; echo; done ;echo ash:y::foo bar: bash:y::foo bar: zsh:y::foo bar: -- tv@{{hq.yok.utu,havoc,gaeshido}.fi,{debian,wanderer}.org,stonesoft.com} double a,b=4,c;main(){for(;++a<2e6;c-=(b=-b)/a++);printf("%f\n",c);} -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]