Why I am glad I know perl 
Author Message
 Why I am glad I know perl

Here is just one reason why every system administrator should know perl.

Scenario:  Sitting in a window on a standalone workstation as root.

           Enter "rm *" assuming that I am in /foobar/blech/bin.

           Notice that I must have been in /bin because "ls" no longer
           exists.  Panic begins to set in.

           Confirm that I was really in /bin.  Panic mounts.

           Use ftp (from /usr/bin) to suck over some executables from
           a similar workstation.  Hmmm.... Ftp doesn't preserve modes.
           Panic level increasing.

           Perl!!  Perl has a built in chmod!

           Use echo to construct a script that will set execute bits on
           sh, tar, cat, ls.

           Tar up /bin on remote workstations and extract to fully
           restore /bin.

           Peace and tranquility have been restored along with /bin.
           {*filter*} pressure returns to normal.  Life goes on.

Buy the book.  Read the book.  Learn Perl.

Note that this would not work on a Sun as /bin is a link to /usr/bin and
ftp would have vanished along with everything else.  

--
Dan Ehrlich - Sr. Systems Programmer - Penn State Computer Science
"Universities should be safe havens where ruthless examination of
 realities will not be distorted by the aim to please or inhibited
 by the risk of displeasure." - Kingman Brewster



Sat, 25 Mar 1995 23:50:52 GMT  
 Why I am glad I know perl
|> Here is just one reason why every system administrator should know perl.
|>  [.....]
|>            Use echo to construct a script that will set execute bits on
|>            sh, tar, cat, ls.
|>  [.....]

|> Note that this would not work on a Sun as /bin is a link to /usr/bin and
|> ftp would have vanished along with everything else.  

But in that case, you'd just use echo to construct a perl script that
mimics ftp (-:



Sun, 26 Mar 1995 01:14:18 GMT  
 Why I am glad I know perl

 Dan> Here is just one reason why every system administrator should know perl.
[scenario deleted]
 Dan> Buy the book.  Read the book.  Learn Perl.

Compile a copy statically linked.  Put it in /sbin.  If /sbin is your life
raft, Perl is your Swiss Army Chainsaw.  Nobody should be stuck on a
single-user island without a Swiss Army Chainsaw in their life raft.
--
Christopher K. Davis      |       NET.INSIGHTS INTO ARTISTIC CRITICISM:

System Administrator, EFF | in one museum, you cure it by throwing tomatoes



Sun, 26 Mar 1995 04:17:48 GMT  
 Why I am glad I know perl

Quote:

>Here is just one reason why every system administrator should know perl.

>Scenario:  Sitting in a window on a standalone workstation as root.

>           Enter "rm *" assuming that I am in /foobar/blech/bin.

>           Notice that I must have been in /bin because "ls" no longer
>           exists.  Panic begins to set in.

>           Confirm that I was really in /bin.  Panic mounts.

>           Use ftp (from /usr/bin) to suck over some executables from
>           a similar workstation.  Hmmm.... Ftp doesn't preserve modes.
>           Panic level increasing.

>           Perl!!  Perl has a built in chmod!

>           Use echo to construct a script that will set execute bits on
>           sh, tar, cat, ls.

>           Tar up /bin on remote workstations and extract to fully
>           restore /bin.

>           Peace and tranquility have been restored along with /bin.
>           {*filter*} pressure returns to normal.  Life goes on.

>Buy the book.  Read the book.  Learn Perl.

>Note that this would not work on a Sun as /bin is a link to /usr/bin and
>ftp would have vanished along with everything else.  

Ah, but ftp is in /usr/ucb on a Sun. Good story, though. Perl is a very
useful tool.

        -Kartik



Sun, 26 Mar 1995 02:27:10 GMT  
 Why I am glad I know perl

Quote:

>Here is just one reason why every system administrator should know perl.

>Scenario:  Sitting in a window on a standalone workstation as root.
>           Enter "rm *" assuming that I am in /foobar/blech/bin.

System administrators, at least those who are worth their salt, do
not enter "rm *" as root unless they mean it.    As wonderful as perl
may be, it's no substitute for extraordinary care when one is su'd.

Anachronistically still using awk, sed, and the rest,
---Rsk



Sun, 26 Mar 1995 10:17:54 GMT  
 Why I am glad I know perl

: >Here is just one reason why every system administrator should know perl.
: >
: >Scenario:  Sitting in a window on a standalone workstation as root.
: >           Enter "rm *" assuming that I am in /foobar/blech/bin.
:
: System administrators, at least those who are worth their salt, do
: not enter "rm *" as root unless they mean it.    As wonderful as perl
: may be, it's no substitute for extraordinary care when one is su'd.

And, of course, extraordinary care is no substitute for a good set of
backup tapes.  :-)

I almost never get caught by using rm in the wrong directory.  I always
read my newfs three times before typing return.  I'll often cd to the
parent directory and do an rm -rf and then a mkdir just to avoid doing
an "rm *".  What usually gets me is something like, say, starting to
type "rm *.old", thinking better of it after typing the *, reaching for
the backspace key and hitting return instead.

It only helps a little to be the fastest ^C in the West.

: Anachronistically still using awk, sed, and the rest,

I still use awk and sed all day long too, but I call them Perl.  :-)

Larry



Mon, 27 Mar 1995 00:09:07 GMT  
 Why I am glad I know perl

:What usually gets me is something like, say, starting to
:type "rm *.old", thinking better of it after typing the *, reaching for
:the backspace key and hitting return instead.

One of the nice features about tcsh as an interactive shell
(not a programming language, of course) is that if $rmstar
is set, it find's mistakes like

    rm * .o

mistakes.

:It only helps a little to be the fastest ^C in the West.

I know.  Rm is too small a program.   Maybe we should use the
GNU version? :-)

:: Anachronistically still using awk, sed, and the rest,
:
:I still use awk and sed all day long too, but I call them Perl.  :-)

I still use Latin frequently, and call it Spanish, French, or whatever. :-)

[Followups to appropriate groups for wherever this thread goes, please.]

--tom

--

    Just don't compare it with a real language, or you'll be unhappy...  :-)



Mon, 27 Mar 1995 00:56:40 GMT  
 Why I am glad I know perl

ehrlich> Scenario:  Sitting in a window on a standalone workstation as root.

ehrlich>            Enter "rm *" [...in /bin...]

ehrlich>            Use ftp (from /usr/bin) [...]

ehrlich> Note that this would not work on a Sun as /bin is a link to
ehrlich> /usr/bin and ftp would have vanished along with everything
ehrlich> else.

But, then, rwho is in /usr/ucb .... (Think about it. See below if you
give up)

I saw this in a list of "the ten grossest UNIX tricks" or something to
that effect.

                        -AJS

perl -pe '$_=reverse $_;' << __EOF__
neht ,)siht rof ydnah s'lrep( atad eht edocneuu ot deen uoY :REWSNA
si dleif tsoh_tu eht( eceip yb eceip pmtu/cte/ otni ti tup      
,atad fo "tekcap" hcae teg ot ohwr esu nehT .)siht rof lufesu
.ti gnidoced retfa ,elif thgir eht otni ti tup dna

)-; ...noitulos lacitcarp a ton s'ti wonk I ,seY :SP

__EOF__
--
--------
Disclaimer: I am solely responsible for the content of this message.
The views expressed here may not be the views of I-Kinetics, Fidelity,
any of the Fidelity-owned corporations or my mother.



Mon, 27 Mar 1995 03:06:50 GMT  
 Why I am glad I know perl

Quote:

> System administrators, at least those who are worth their salt, do
> not enter "rm *" as root unless they mean it.    As wonderful as perl
> may be, it's no substitute for extraordinary care when one is su'd.

> Anachronistically still using awk, sed, and the rest,
> ---Rsk

Soooooo correct.  When I did sys admin I *always* did ls -l * before doing a rm *.
--
---------------------------------
Tom Stephens
Corporate Computing and Networks, Chippewa Falls, WI



Sun, 26 Mar 1995 23:34:32 GMT  
 Why I am glad I know perl

Quote:


>:What usually gets me is something like, say, starting to
>:type "rm *.old", thinking better of it after typing the *, reaching for
>:the backspace key and hitting return instead.

>One of the nice features about tcsh as an interactive shell
>(not a programming language, of course) is that if $rmstar
>is set, it find's mistakes like

>    rm * .o

>mistakes.

>:It only helps a little to be the fastest ^C in the West.

>I know.  Rm is too small a program.   Maybe we should use the
>GNU version? :-)

A good habit to get into, if you use a shell that does globbing
expansion when you hit tab, is to ALWAYS tab-expand any wildcards before
you hit RETURN... gives you a second chance to change your mind and also
lets you review exactly what your pattern is going to glob to before you
hit enter...

i.e.

rm *~<tab>

then think to yourself "Gee, am I SURE I want to remove all those
annoying emacs backup files?  And why was I using emacs in the first
place instead of vi?" and then hit enter.

-----

Weird?  We've experienced *death*!  Now somehow we've brought back our
sins physically, and they're *pissed*.



Mon, 27 Mar 1995 08:53:19 GMT  
 Why I am glad I know perl

Quote:

>>Here is just one reason why every system administrator should know perl.

>>Scenario:  Sitting in a window on a standalone workstation as root.
>>           Enter "rm *" assuming that I am in /foobar/blech/bin.
>System administrators, at least those who are worth their salt, do
>not enter "rm *" as root unless they mean it.    As wonderful as perl
>may be, it's no substitute for extraordinary care when one is su'd.
>Anachronistically still using awk, sed, and the rest,
>---Rsk

and a system administrator should alias is rm to 'rm -i' anyways,
always!

still trying to learn awk sed and grep and all those animals ...  :-)

francis

--
| B.F. Francis Ouellette  
| manager, yeast chromosome I project
| dept of biology, McGill university, Montreal, Qc, Canada



Mon, 27 Mar 1995 13:05:54 GMT  
 
 [ 22 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Glad I bought Effective Perl Programming

2. newbie-perl or why am i blind to this simple

3. Why am I dumping core???

4. ? Now I am reaaly perplexed, Why doesn't (INDEX) work

5. Why am I stuck?

6. Why am I running out of memory?

7. Why am I getting an error with @_ ?

8. Why am I getting this regexp error?

9. why am I trashing binary files with this?

10. Why am I getting an undefined subroutine error?

11. why am I having problems with mkdir

12. anyone know why this wont send USERMAIL (script included)

 

 
Powered by phpBB® Forum Software