[SFS] bash - things you can't do with backticks

Jeffrey S. Haemer jeffrey.haemer@gmail.com
Mon, 24 Mar 2014 10:00:07 -0600


--089e013a0d7287493904f55c558e
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On the other hand, $() didn't become an IEEE and ISO/IEC standard until
1992 . No point in rushing into using it. Always good to be cautious. :-)


On Mon, Mar 24, 2014 at 9:51 AM, Jed Walker <jedwa@comcast.net> wrote:

> Indeed! The backticks just annoy me, I too prefer $() if definitely reads
> better. And makes more sense. I=E2=80=99m sure I=E2=80=99ve nested it in =
a script
> somewhere, if I remember and can find it I=E2=80=99ll let you know.
>
>
>
> *From:* sfs-admin@thegeek.nu [mailto:sfs-admin@thegeek.nu] *On Behalf Of =
*David
> L. Willson
> *Sent:* Monday, March 24, 2014 9:24 AM
> *To:* sfs
> *Cc:* Jeffrey S. Haemer
> *Subject:* [SFS] bash - things you can't do with backticks
>
>
>
> I always use something like this "$( expression )" to get "the output of
> expression", rather than backticks like this "` expression `" and teach
> others to do likewise for two reasons: It's more readable and it's
> nestable. But, when teaching, I can never come up with a good example of
> nesting, so today, I happen to have one. I want to delete all the files i=
n
> this directory, except the newest three.
>
>
> rm $( ls -tr | head -n $(( $( ls -tr | wc -l ) - 3 )))
>
>
> It has some big bugs and I cannot lie, but it does demonstrate nesting.
>
> --
> David L. Willson
> Teacher, Engineer, Evangelist
> RHCE+Satellite CCAH Network+ A+ Linux+ LPIC-1 UbuntuCP NovellCLA
> Mobile 720-333-LANS(5267)
> http://sofree.us
>
> This is a good time for a r3VOLution.
>
>


--=20
Jeffrey Haemer <jeffrey.haemer@gmail.com>
720-837-8908 [cell], http://seejeffrun.blogspot.com [blog],
http://www.youtube.com/user/goyishekop [vlog]
*=D7=A4=D7=A8=D7=99=D7=99=D7=94=D7=99=D7=99=D7=98? =D7=93=D7=90=D7=A1 =D7=
=90=D7=99=D7=96 =D7=99=D7=90=D6=B7=D7=A0=D7=92 =D7=93=D7=99=D7=A0=D7=A2=D7=
=9F =D7=95=D7=95=D7=90=D6=B8=D7=A8=D7=98.*

--089e013a0d7287493904f55c558e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On the other hand, $() didn&#39;t become an IEEE and ISO/I=
EC standard until 1992 . No point in rushing into using it. Always good to =
be cautious. :-)</div><div class=3D"gmail_extra"><br><br><div class=3D"gmai=
l_quote">

On Mon, Mar 24, 2014 at 9:51 AM, Jed Walker <span dir=3D"ltr">&lt;<a href=
=3D"mailto:jedwa@comcast.net" target=3D"_blank">jedwa@comcast.net</a>&gt;</=
span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8e=
x;border-left:1px #ccc solid;padding-left:1ex">

<div lang=3D"EN-US" link=3D"blue" vlink=3D"purple"><div><p class=3D"MsoNorm=
al"><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;s=
ans-serif&quot;;color:#1f497d">Indeed! The backticks just annoy me, I too p=
refer $() if definitely reads better. And makes more sense. I=E2=80=99m sur=
e I=E2=80=99ve nested it in a script somewhere, if I remember and can find =
it I=E2=80=99ll let you know.<u></u><u></u></span></p>

<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>=C2=A0<u></u></spa=
n></p><div><div style=3D"border:none;border-top:solid #b5c4df 1.0pt;padding=
:3.0pt 0in 0in 0in">

<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href=
=3D"mailto:sfs-admin@thegeek.nu" target=3D"_blank">sfs-admin@thegeek.nu</a>=
 [mailto:<a href=3D"mailto:sfs-admin@thegeek.nu" target=3D"_blank">sfs-admi=
n@thegeek.nu</a>] <b>On Behalf Of </b>David L. Willson<br>

<b>Sent:</b> Monday, March 24, 2014 9:24 AM<br><b>To:</b> sfs<br><b>Cc:</b>=
 Jeffrey S. Haemer<br><b>Subject:</b> [SFS] bash - things you can&#39;t do =
with backticks<u></u><u></u></span></p></div></div><div><div class=3D"h5">

<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><div><p class=3D"MsoNormal">=
<span style>I always use something like this &quot;$( expression )&quot; to=
 get &quot;the output of expression&quot;, rather than backticks like this =
&quot;` expression `&quot; and teach others to do likewise for two reasons:=
 It&#39;s more readable and it&#39;s nestable. But, when teaching, I can ne=
ver come up with a good example of nesting, so today, I happen to have one.=
 I want to delete all the files in this directory, except the newest three.=
<br>

<br><br>rm $( ls -tr | head -n $(( $( ls -tr | wc -l ) - 3 )))<br><br><br>I=
t has some big bugs and I cannot lie, but it does demonstrate nesting.<br><=
br>--<br>David L. Willson<br>Teacher, Engineer, Evangelist<br>RHCE+Satellit=
e CCAH Network+ A+ Linux+ LPIC-1 UbuntuCP NovellCLA<br>

Mobile 720-333-LANS(5267)<br><a href=3D"http://sofree.us" target=3D"_blank"=
>http://sofree.us</a><br><br>This is a good time for a r3VOLution.<br><br><=
u></u><u></u></span></p></div></div></div></div></div></blockquote></div><b=
r>

<br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr">Jeffrey Haemer &lt=
;<a href=3D"mailto:jeffrey.haemer@gmail.com" target=3D"_blank">jeffrey.haem=
er@gmail.com</a>&gt;<br>720-837-8908 [cell],=C2=A0<a href=3D"http://seejeff=
run.blogspot.com" target=3D"_blank">http://seejeffrun.blogspot.com</a> [blo=
g],<div>

<a href=3D"http://www.youtube.com/user/goyishekop" target=3D"_blank">http:/=
/www.youtube.com/user/goyishekop</a> [vlog]</div><div><div style=3D"margin-=
top:15px;margin-right:0px;margin-bottom:5px;margin-left:5px"><div dir=3D"rt=
l" style=3D"font-family:arial,sans-serif;font-size:13px;zoom:1">

<span style=3D"font-family:garamond,serif;line-height:17px;font-size:small"=
><i><span style=3D"border-collapse:collapse;font-family:arial,sans-serif;fo=
nt-size:14px;line-height:18px;font-style:normal"><span title=3D""><font fac=
e=3D"&#39;times new roman&#39;, serif"><span style=3D"font-size:small">=D7=
=A4=D7=A8=D7=99=D7=99=D7=94=D7=99=D7=99=D7=98?=C2=A0</span></font></span><s=
pan title=3D""><font face=3D"&#39;times new roman&#39;, serif"><span style=
=3D"font-size:small">=D7=93=D7=90=D7=A1 =D7=90=D7=99=D7=96 =D7=99=D7=90=D6=
=B7=D7=A0=D7=92 =D7=93=D7=99=D7=A0=D7=A2=D7=9F =D7=95=D7=95=D7=90=D6=B8=D7=
=A8=D7=98.</span></font></span></span></i></span></div>

</div></div></div>
</div>

--089e013a0d7287493904f55c558e--