<div dir="ltr">a good example is copying ownership of a set of files from one computer to another.<br>lets say someone messed up the permissions for all of /opt recursively, but we have the same /opt on another computer. we can obtain an ls-like description of all the files with<br>
<span style="font-family: courier new,monospace;">find /opt | xargs -n1 ls -ld</span><br>copy the output to another computer and run<br><span style="font-family: courier new,monospace;">cat /tmp/permissions.out | awk '{print $3 ":" $4, $8}' | xargs -n2 chown</span><br>
i once saved a solaris machine that someone ran "chown -R root:root /" on with that. <br><br><div class="gmail_quote">On Mon, Nov 2, 2009 at 13:26, Orna Agmon Ben-Yehuda <span dir="ltr"><<a href="mailto:ladypine@gmail.com">ladypine@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><br><br><div class="gmail_quote"><div class="im">On Mon, Nov 2, 2009 at 1:02 PM, Shahar Dag <span dir="ltr"><<a href="mailto:dag@cs.technion.ac.il" target="_blank">dag@cs.technion.ac.il</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff">
<div><font face="Arial" size="2">Hello all</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">mix & match is just a buzzword.</font></div>
<div><font face="Arial" size="2"></font></div></div></blockquote></div><div><br>You are right I should have explained myself. When I said "mix&match" I meant, for example, that I can use different compilers (gcc of different versions, pgcc, intel c, won't go into detail about the Fortran compilers I mix with those) in a very similar environment, such that to switch between them I only change an environment variable ($FC). I am not bound to a specific compiler by an IDE and project file. This gives me easy portability, which gives me automatic checks that some compilers ignore (gcc is better at warnings, Intel is better at speed on intel). I can also combine those with various other tools such as ccache and at least two different pre-processors.<br>
</div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div bgcolor="#ffffff"><div><font face="Arial" size="2">we need a real example that shows that 10 minutes
of shell scripting will save half a day of programming.</font></div>
<div><font face="Arial" size="2">(no, grep -v is not an example)</font></div>
<div><font face="Arial" size="2"></font> </div></div></blockquote></div><div><br>Change all files foo* to bar*. Easy with make or a shell loop, I am not familiar with a convenient ready-made tool. <br> </div><div><div></div>
<div class="h5"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff">
<div><font face="Arial" size="2">as for scripts & Windows</font></div>
<div><font face="Arial" size="2">Windows have many scripting capabilities. It is
true that we mostly ignore them (maybe becase they are complicated)</font></div>
<div><font face="Arial" size="2">1. batch files</font></div>
<div><font face="Arial" size="2">2. visual basic scrips (if you know how, you can
use any dll in the system to do a job for you)</font></div>
<div><font face="Arial" size="2">3. power shell</font></div>
<div><font face="Arial" size="2">4. and of course cygwin</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">make can be run on windows & even if you create
source dependencis, you still have to handle the dependency on header files.
</font><font face="Arial" size="2">The problem (almost) does not exist in IDE
environment (which is the windows way)</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Valgrind is an execelt tool (and it helped me a
lote) but it is relevant only for languages that do not have memory manegment
(C, C++, ...). Java programmers can laugth all the way to the
dedline</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Sorry, please think harder and come out with
somthing more convincing</font></div><div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Thanks in advanced</font></div>
<div><font face="Arial" size="2">Shahar Dag</font></div>
<div><font face="Arial" size="2"></font> </div>
</div><blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"><div><div></div><div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>
<a title="ladypine@gmail.com" href="mailto:ladypine@gmail.com" target="_blank">Orna Agmon
Ben-Yehuda</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> <a title="vadim.eisenberg@gmail.com" href="mailto:vadim.eisenberg@gmail.com" target="_blank">Vadim Eisenberg</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Cc:</b> <a title="haifux@haifux.org" href="mailto:haifux@haifux.org" target="_blank">Haifux</a> ; <a title="dag@cs.technion.ac.il" href="mailto:dag@cs.technion.ac.il" target="_blank">Shahar Dag</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> Monday, November 02, 2009 11:55
AM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b> Re: [Haifux] advanced of
programming in Linux</div>
<div><br></div>
<div dir="ltr">I think the strong point is "The Unix Way", which is a mix and
match of tools, each good at doing a specific thing, by using shell , pipe and
make. Linux did not invent "The Unix Way", but like other FOSS, it provides
more options for the mix and match. Indeed many Unix systems are closed
source, and the Unix Way works there, too (better than it would work on
Windows, I expect). <br><br>A point specific to Linux and Intel/AMD is
valgrind, with which I nowadays solve memory issues within seconds of
programmer time. Solving similar problems before I had Linux took me weeks
sometimes (for a code I was not familiar with, of tens of thousands of lines),
and sometimes I just gave up.<br><br>
<div class="gmail_quote">On Mon, Nov 2, 2009 at 11:16 AM, Vadim Eisenberg <span dir="ltr"><<a href="mailto:vadim.eisenberg@gmail.com" target="_blank">vadim.eisenberg@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div vlink="purple" link="blue" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">I
would like to present some points of a devil's advocate (some smart students
can raise these counterclaims during the lecture) :</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"><span>1.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span><span dir="ltr"></span><span style="font-size: 11pt; color: rgb(31, 73, 125);">You can run batch files also
on Windows (it for sure is less convenient than shell scripts on Unix, but
it is not impossible)</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"><span>2.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span><span dir="ltr"></span><span style="font-size: 11pt; color: rgb(31, 73, 125);">You can use Ant instead of
makefile (it is also less convenient than makefile + shell scripts, but is
still possible)</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"><span>3.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span><span dir="ltr"></span><span style="font-size: 11pt; color: rgb(31, 73, 125);">You can use Perl on
Windows</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"><span>4.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span><span dir="ltr"></span><span style="font-size: 11pt; color: rgb(31, 73, 125);">UNIX remark: I guess all the
tools you mention pertain to Unix also, so in general you provide points for
learning Unix tools, not necessary Linux ones. In particular, you probably
can use them on cygwin on Windows.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"></span> </p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">In
general, my suspicion is that anything you can do in Unix, you can do also
in Windows, but in a less convenient/less productive way. </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"></span> </p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">I
hope not to make anybody here angry by providing such heretic
remarks.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"></span> </p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Regards,</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Vadim</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"></span> </p>
<div style="border-style: none none none solid; border-color: -moz-use-text-color; border-width: medium medium medium 1.5pt; padding: 0cm 0cm 0cm 4pt;">
<div>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:haifux-bounces@haifux.org" target="_blank">haifux-bounces@haifux.org</a> [mailto:<a href="mailto:haifux-bounces@haifux.org" target="_blank">haifux-bounces@haifux.org</a>] <b>On Behalf Of </b>Orna Agmon
Ben-Yehuda<br><b>Sent:</b> Monday, November 02, 2009 10:51 AM<br><b>To:</b>
Shahar Dag<br><b>Cc:</b> Haifux<br><b>Subject:</b> Re: [Haifux] advanced of
programming in Linux</span></p></div></div>
<div>
<div></div>
<div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">I often see people spending
approximately an hour each time, trying to understand why their change was
not included in the executable. The answer is usually - because they forgot
to insert the source into the list of sources in the makefile. When I show
them how to automatically create a list of sources and compile them all,
with the correct dependencies, the problem is forever solved.<br><br>I use a
makefile to build Haifux's site automatically in two languages, while
compiling lists of lectures in different pages.<br><br>I use make to
properly build latex files, including the second pass required for
bibtex.<br><br>I use make ,diff, head to create automatic tests (regression
tests) for various programs, compare them automatically with previous
results, and produce a report of added capabilities, lost capabilities,
changes requiring the attention of a professional.<br><br>I use make and
perl to create parametric sweep runs (batch runs with different input
parameters in each run). I specifically use here the inherent quality of
make, to work according to the date of targets, so that if the parametric
sweep was disturbed in the middle, only runs older than the executable and
input file are re-run.</p>
<div>
<p class="MsoNormal">2009/11/1 Shahar Dag <<a href="mailto:dag@cs.technion.ac.il" target="_blank">dag@cs.technion.ac.il</a>></p>
<div>
<div>
<p class="MsoNormal"><span>Hello</span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span>To extent Elli's question:</span></p>
<p class="MsoNormal"><span>We try to convince our students that programming on
Linux is easier / faster relative to Windows, so they better learn how to
work with Linux.</span></p>
<p class="MsoNormal"><span></span> </p>
<p class="MsoNormal"><span>We claim that using the build in shell commands and
pipes we can compose a solution for complex problem (almost) without
programming.</span></p>
<p class="MsoNormal"><span></span> </p>
<p class="MsoNormal"><span>Can you point us for real life examples that prove
our claims? </span></p>
<p class="MsoNormal"><span></span> </p>
<p class="MsoNormal"><span>Thanks in advanced</span></p>
<p class="MsoNormal"><span style="font-size: 10pt;">Shahar Dag<br>System &
Software Development Laboratory (SSDL)<br>Computer Science
Department<br>Technion - Israel Institute of Technology<br>Haifa,
Israel<br>Tel. 972-4-829-4880<br>Fax 972-4-829-4878</span></p></div></div>
<p class="MsoNormal" style="margin-bottom: 12pt;"><br>_______________________________________________<br>Haifux
mailing list<br><a href="mailto:Haifux@haifux.org" target="_blank">Haifux@haifux.org</a><br><a href="http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux" target="_blank">http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux</a></p>
</div>
<p class="MsoNormal"> </p></div></div></div></div></div></div></blockquote></div><br></div>
</div></div><p>
</p><hr><div>
<p></p>_______________________________________________<br>Haifux mailing
list<br><a href="mailto:Haifux@haifux.org" target="_blank">Haifux@haifux.org</a><br><a href="http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux" target="_blank">http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux</a><br>
</div></blockquote></div>
<br>_______________________________________________<br>
Haifux mailing list<br>
<a href="mailto:Haifux@haifux.org" target="_blank">Haifux@haifux.org</a><br>
<a href="http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux" target="_blank">http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux</a><br>
<br></blockquote></div></div></div><br></div>
<br>_______________________________________________<br>
Haifux mailing list<br>
<a href="mailto:Haifux@haifux.org">Haifux@haifux.org</a><br>
<a href="http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux" target="_blank">http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><br><a href="http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html" target="_blank">Stephen Leacock</a> - "I detest life-insurance agents: they always argue that I shall some day die, which is not so."
</div>