PDA

View Full Version : Different Unix shells?


mholloway
04-10-2002, 09:39 PM
Forgive the ignorance. :confused:

A few years ago I used to toy around with FreeBSD but it has been so long since I've touched Unix. I'm very anxious to learn again, but I have a few questions and some commenary.

First, when I was a Network Administrator at a health care company, I used to watch the System Administrators work away on their HP-UX servers and workstations. I know there are some slight differences between the different vendors' flavors of Unix, but how abuout the actual Unix Shells themselves? OS X ships standard with TCSH, but is it good to know the Korn shell? How much different is the scripting between TCSH, Korn, and other popular shells? And what can I expect to find in the Enterprise?

A quick search on dice.com for "Unix Administrator" quickly shows companies want Unix Administrators who are also programmers - but is that more of a wishlist or do most Unix administrator know C?

I appreciate the feedback!

Regards,
Mark

Craig R. Arko
04-10-2002, 09:46 PM
Well, bash is a very popular shell. Apple doesn't include it (although it's very strongly rumored to be in 10.2), but a lot of folks download it or install it via the fink (http://fink.sourceforge.net/) package manager.

rusto
04-10-2002, 10:15 PM
I've been using bash for a while now, installed using instructions found here:

http://www.bombich.com/mactips/x1.html

mholloway
04-11-2002, 12:55 AM
And how about learning Unix scripting? I purchased a Unix scripting book (learn Unix Scripting in 14 days) and it seems as "shell independent" as possible, although it says BASH and KORN are the most popular and BASH scripts can be used in KORN without modification.

My goal is to learn as much about "Unix" as possible before plunging into a specific flavor. At the enterprise, I'm assuming Solaris and HP-UX are the most popular commercial versions, and Linux and BSD being the most popular Open Source/Free flavors of Unix. When I worked as a network engineer before, I was in a position where networking was strictly routing, switching, VLAN, VPN, all on Cisco, 3Com, and Nortel equipment. The "Network" guys never touched the system admin's toys, and the sys admins never touched the network admin's toys. Today, I'm being asked by more and more technical recruiters if I have any OS skills in addition to networking. It seems Unix more logically crosses paths with networking than Windows. I did the whole MCSE / NT Admin thing in 1997/98 and told myself I will never do it again. I never re-certified my MCSE but I did learn a lot from the TCP/IP elective and IIS 4 elective that proved beneficial later on.

Regards,
Mark

honestpuck
04-13-2002, 01:40 PM
Mark,

I always think you should start with the masters. "The Unix Programming Environment" by Kernighan and Pike is a marvellous start to learning how to wrangle a Unix system into submission.

It includes nice bits on shell programming, awk, grep and then goes on to the more arcane like yacc and lex.

Tony

macubergeek
04-21-2002, 08:47 AM
Ok first of all some shells are known as being good interactive shells...ie for typing command lines in at console....exampls of these would be tcsh or bash...What makes them good? They have nifty features like up arrow-return to repeat the last command....history feature.
Now Bourne is the preferred shell for shell scripting...Among other things Bourne is virutally identical on and comes with every flavor of unix so scripts written in it will pretty much run on any unix system.

Finally there is perl. Again perl comes with most free unixen (freebsd and linux and Darwin/macosx)

Suggested books:
"Portable Shell Programming" Bruce Blinn--everything you need to know about Bourne Shell scripting

"Elements of Programming with Perl" Andrew L. Johnson...the best intro text to perl imho....also check out the O'reilly books on perl....when you're more experienced.

As far as flavors of unix, Solaris is the market share leader among the various flavors of commercial unixen.
FreeBSD or RedHat Linux are the leaders among free unixen.

Cheerios
04-22-2002, 01:26 PM
ok, bash and tcsh are different shells... I thought bourne was a type of shell of which there are a couple shells of that type... sh, bash, I thought both fell under that term... *note* all from 2nd hand knowledge, so could be WAY out there...

am I confused?? What does it mean, to be using a Borne shell, anyway? Wow... the questions keep piling up... maybe I should break down and curl up with a Unix or Linux book, and quit pesterin y'all ;)

edit: grammer, my greatest enemy!

mervTormel
04-22-2002, 01:47 PM
there are several families of shells:

bourne shell (sh, ksh, bash)

c shell (csh, tcsh)

here's a relevant doc that provides a good foundation for further study :]

http://www.faqs.org/faqs/unix-faq/shell/shell-differences/

macubergeek
04-22-2002, 06:24 PM
You can also switch shells.
your default under macosx is tcsh
you can type sh and return at the command prompt and then your in bourne shell.
You can install bash shell (its an application you can download from macosx.forked.net) and type bash to enter the bash shell.

Just stick with tcsh for now.

if you hit the uparrow on your keyboard you can cycle through the last five or so commands you've typed...then hit return again...that way you don't have to retype the command.

mervTormel
04-22-2002, 06:44 PM
you can set the shell history variable to the number of commands to remember [and savehist to merge multiple tcsh shell window's histories]...

set histfile = .tcsh_history
set history = 500
set savehist = ( 500 merge )
alias zgh 'history | grep \!:1'

then you can do stupid (contrived) things like

% zgh ping
217 18:57 ping 01.test.com
218 18:57 ping 02.test.com
219 18:57 ping localhost
220 18:57 ping 127.0.0.1
252 16:27 history | grep ping

% !220 <tab> # expands to historical command 220, allowing edits

% ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.253 ms

--
stupid is as stupid does and trix are for kids