[Haifux] advanced of programming in Linux

boazg boaz.gezer at gmail.com
Mon Nov 2 14:40:14 MSK 2009


a good example is copying ownership of a set of files from one computer to
another.
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
find /opt | xargs -n1 ls -ld
copy the output to another computer and run
cat /tmp/permissions.out | awk '{print $3 ":" $4, $8}' | xargs -n2 chown
i once saved a solaris machine that someone ran "chown -R root:root /" on
with that.

On Mon, Nov 2, 2009 at 13:26, Orna Agmon Ben-Yehuda <ladypine at gmail.com>wrote:

>
>
> On Mon, Nov 2, 2009 at 1:02 PM, Shahar Dag <dag at cs.technion.ac.il> wrote:
>
>>  Hello all
>>
>> mix & match is just a buzzword.
>>
>
> 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.
>
>
>> we need a real example that shows that 10 minutes of shell scripting will
>> save half a day of programming.
>> (no, grep -v is not an example)
>>
>>
>
> Change all files foo* to bar*. Easy with make or a shell loop, I am not
> familiar with a convenient ready-made tool.
>
>
>>  as for scripts & Windows
>> Windows have many scripting capabilities. It is true that we mostly ignore
>> them (maybe becase they are complicated)
>> 1. batch files
>> 2. visual basic scrips (if you know how, you can use any dll in the system
>> to do a job for you)
>> 3. power shell
>> 4. and of course cygwin
>>
>> make can be run on windows & even if you create source dependencis, you
>> still have to handle the dependency on header files. The problem (almost)
>> does not exist in IDE environment (which is the windows way)
>>
>> 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
>>
>> Sorry, please think harder and come out with somthing more convincing
>>
>> Thanks in advanced
>> Shahar Dag
>>
>>
>> ----- Original Message -----
>>  *From:* Orna Agmon Ben-Yehuda <ladypine at gmail.com>
>> *To:* Vadim Eisenberg <vadim.eisenberg at gmail.com>
>> *Cc:* Haifux <haifux at haifux.org> ; Shahar Dag <dag at cs.technion.ac.il>
>> *Sent:* Monday, November 02, 2009 11:55 AM
>> *Subject:* Re: [Haifux] advanced of programming in Linux
>>
>> 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).
>>
>> 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.
>>
>> On Mon, Nov 2, 2009 at 11:16 AM, Vadim Eisenberg <
>> vadim.eisenberg at gmail.com> wrote:
>>
>>>  I would like to present some points of a devil's advocate (some smart
>>> students can raise these counterclaims during the lecture) :
>>>
>>> 1.       You can run batch files also on Windows (it for sure is less
>>> convenient than shell scripts on Unix, but it is not impossible)
>>>
>>> 2.       You can use Ant instead of makefile (it is also less convenient
>>> than makefile + shell scripts, but is still possible)
>>>
>>> 3.       You can use Perl on Windows
>>>
>>> 4.       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.
>>>
>>>
>>>
>>> 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.
>>>
>>>
>>>
>>> I hope not to make anybody here angry by providing such heretic remarks.
>>>
>>>
>>>
>>> Regards,
>>>
>>> Vadim
>>>
>>>
>>>
>>> *From:* haifux-bounces at haifux.org [mailto:haifux-bounces at haifux.org] *On
>>> Behalf Of *Orna Agmon Ben-Yehuda
>>> *Sent:* Monday, November 02, 2009 10:51 AM
>>> *To:* Shahar Dag
>>> *Cc:* Haifux
>>> *Subject:* Re: [Haifux] advanced of programming in Linux
>>>
>>>
>>>
>>> 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.
>>>
>>> I use a makefile to build Haifux's site automatically in two languages,
>>> while compiling lists of lectures in different pages.
>>>
>>> I use make to properly build latex files, including the second pass
>>> required for bibtex.
>>>
>>> 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.
>>>
>>> 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.
>>>
>>> 2009/11/1 Shahar Dag <dag at cs.technion.ac.il>
>>>
>>> Hello
>>>
>>>
>>>
>>> To extent Elli's question:
>>>
>>> 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.
>>>
>>>
>>>
>>> We claim that using the build in shell commands and pipes we can compose
>>> a solution for complex problem (almost) without programming.
>>>
>>>
>>>
>>> Can you point us for real life examples that prove our claims?
>>>
>>>
>>>
>>> Thanks in advanced
>>>
>>> Shahar Dag
>>> System & Software Development Laboratory (SSDL)
>>> Computer Science Department
>>> Technion - Israel Institute of Technology
>>> Haifa, Israel
>>> Tel. 972-4-829-4880
>>> Fax 972-4-829-4878
>>>
>>>
>>> _______________________________________________
>>> Haifux mailing list
>>> Haifux at haifux.org
>>> http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux
>>>
>>>
>>>
>>
>>  ------------------------------
>>
>> _______________________________________________
>> Haifux mailing list
>> Haifux at haifux.org
>> http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux
>>
>>
>> _______________________________________________
>> Haifux mailing list
>> Haifux at haifux.org
>> http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux
>>
>>
>
> _______________________________________________
> Haifux mailing list
> Haifux at haifux.org
> http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux
>
>


-- 

Stephen Leacock<http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html>
- "I detest life-insurance agents: they always argue that I shall some
day
die, which is not so."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://haifux.org/pipermail/haifux/attachments/20091102/110f6dff/attachment.html 


More information about the Haifux mailing list