Skip to content

Instantly share code, notes, and snippets.

@kyanagi
Created February 3, 2012 07:54
Show Gist options
  • Save kyanagi/1728838 to your computer and use it in GitHub Desktop.
Save kyanagi/1728838 to your computer and use it in GitHub Desktop.
function f {
local s='old'
echo -n "${(r:15:: :)1}${(e)1}"
s=''
echo -n "\t${(e)1}"
unset s
echo -n "\t${(e)1}"
echo
}
f '${s}'
f '${+s}'
f '${s-new}'
f '${s:-new}'
f '${s+new}'
f '${s:+new}'
f '${s=new}'
f '${s:=new}'
f '${s::=new}'
# ${s} old
# ${+s} 1 1 0
# ${s-new} old new
# ${s:-new} old new new
# ${s+new} new new
# ${s:+new} new
# ${s=new} old new
# ${s:=new} old new new
# ${s::=new} new new new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment