Found a way to do this in a single line. Works nicely.
eval "last=\\${$#}"
To get the REST of the parameters:
eval “rest=\”`for d in \`seq 1 \$[\$# - 1]\`; do echo -n \\\$\$d\ ; done`\”"
The following works better:
eval “last=\\${$#}”
Crap. It’s the following that works better:
eval “last=\${$#}”
$(echo $@ |cut -d\ -f $#)
last=$(echo $@ |cut -d\ -f $#)
function cu() { eval ‘lasta=$’$#’;'; echo $last; };cu a b c daaa
last=”${!#}”
Your email address will not be published. Required fields are marked *
Name *
Email *
Website
Comment
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Switch to our mobile site
To get the REST of the parameters:
eval “rest=\”`for d in \`seq 1 \$[\$# - 1]\`; do echo -n \\\$\$d\ ; done`\”"
The following works better:
eval “last=\\${$#}”
Crap. It’s the following that works better:
eval “last=\${$#}”
$(echo $@ |cut -d\ -f $#)
last=$(echo $@ |cut -d\ -f $#)
function cu() { eval ‘lasta=$’$#’;'; echo $last; };cu a b c daaa
last=”${!#}”