[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SLUG] Simple Newbie Questions



Wrote Matt:
> Esp the /usr/local/bin .. when it comes to a Linux user's own stuff .. would 
> you say that it's basically /home and /usr/local ?

/usr/local is for site-specific stuff. Leave /usr for distribution installs.
~/bin is for your own personal stuff (good when you don't have write
permission to /usr/local, ie, you are not the sysadmin). I think most people
put stuff they are playing with in ~/bin, and polished scripts, binaries,
source installs in /usr/local.

> 
> Oh yeh, the perl script was for parsing nmap output, shell scripts dont do 
> regular expressions do they ?

'man grep'. But perl is more powerful. And more interesting. But so is awk,
sed..... (grep the list for script.*(guru|help)...)
Shell scripts do whatever you tell them to. 

> Also, Perl scripts CAN be run without #!/bin/sh on my system, it doesnt seem 
> essential, is it essential in bash scripts ?

in order to run a perl script without invoking the perl binary explicitely,
ie, 'myscript.pl', it needs the hash-bang at the start, so the shell knows
what application should be used to run the script:

#!/usr/bin/perl

#!/bin/sed

#!/bin/awk

etc.

> Is using #!/bin/bash exactly the same ?

$ ls -l /bin/sh
lrwxrwxrwx   1 root     root            4 Mar 24 05:48 /bin/sh -> bash

man sh:

       If  Bash  is invoked as sh, it tries to mimic the behavior
       of sh as closely as  possible.   For  a  login  shell,  it
       attempts  to  source  only /etc/profile and ~/.profile, in
       that order.  The -noprofile option may still  be  used  to
       disable  this  behavior.   A  shell invoked as sh does not
       attempt to source any other startup files.

-- 
Cantanker /
---------/----------------
        / az@nospam.cantanker.net
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to slug-request@nospam.slug.org.au with
unsubscribe in the text