Author Topic: Zaurus Linux Shell Scripting Questions  (Read 3323 times)

TonyOlsen

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
    • http://www.userdimensions.com/Tony/Resume.html
Zaurus Linux Shell Scripting Questions
« on: December 16, 2004, 09:21:31 pm »
I'm a UNIX/Linux shell scripting newbie.  I've seen a few Zaurus User Group How-To pages on some script examples and I think I unterstood 85% of what I saw...
  • How many different kinds of shell script (.sh... are there other extensions too?) languages are supported under Linux in the Zaurus?
  • What are the differences between them?
  • Why use one over the other?
  • Where can I find "Shell Scripting For Dummies" kind of resource/page/site?
Thanks!  
Tony Olsen
Ferris@Myself.Com
Resume
Zaurus SL-C860 QTopia
2 GB Static CF
1 GB MMC (although it isn't working yet)
My Quest: To get an x86 emulator working on my Zaurus and to have my Zaurus replace my laptop as my MAIN computer
Publically available Videos for the default Zaurus SL-C860 video player

ran

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Zaurus Linux Shell Scripting Questions
« Reply #1 on: December 17, 2004, 01:17:54 am »
Since you mentioned understanding about 85%,  I suggest grabbing a copy of "The Advanced bash Scripting Guide" and installing it,  and the free version of cygwin,  on your laptop.  Those will give you a good opportunity to teach yourself scripting (and the use of command-line tools in general),  and the Guide makes a superb reference.

I don't know how many different shells are available for Linux.  Certainly bash is the most popular.  There are some similar,  but less-featureful shells,  like sh and ash,  that are commonly used in resource-constrained environments.  There are multiple variants of the C shell,  designed to make C programmers comfortable.  And there are others,  like the Korn shell,  that exist just because people got used to their idiosyncracies under *nix and they were easy to port.    

It's a lot like editors:  there are a few cases where one particular choice is objectively better (like when you're making a rescue system that boots from one or two floopies,  and every byte counts),  but it's mostly a matter of taste.

Ran

doseas

  • Full Member
  • ***
  • Posts: 207
    • View Profile
    • http://
Zaurus Linux Shell Scripting Questions
« Reply #2 on: December 17, 2004, 01:27:35 am »
To add to what ran posted just as I was getting ready to hit "Reply"    ...

Choice of shells is largely a matter of personal preference:  some prefer one set of features or style of syntax over another.  Another factor is whether or not a particular shell is likely to be found under different OS environments or not.  The sh shell is ubiquitous and can be found on every *nix like platform, but lacks some of the more advanced features (history editing, for example) of the somewhat more "bloated" shells like csh or bash.  Both bash and sh appear to be standard on all versions of Linux that I've encountered thus far, but you can usually add ash, ksh and so on.

The "Advanced Bash-Scripting Guide" that ran mentioned is a good resource and can be found at: http://www.tldp.org/LDP/abs/html/index.html  among other places.  Also, "Bash Reference Manual" at http://www.gnu.org/software/bash/manual/bashref.html

ScottYelich

  • Hero Member
  • *****
  • Posts: 992
    • View Profile
    • http://www.zaurususergroup.com/modules.php?opmodload&namephpWiki&filei
Zaurus Linux Shell Scripting Questions
« Reply #3 on: December 17, 2004, 01:56:12 pm »
Quote
I'm a UNIX/Linux shell scripting newbie.  I've seen a few Zaurus User Group How-To pages on some script examples and I think I unterstood 85% of what I saw...
  • How many different kinds of shell script (.sh... are there other extensions too?) languages are supported under Linux in the Zaurus?
  • What are the differences between them?
  • Why use one over the other?
  • Where can I find "Shell Scripting For Dummies" kind of resource/page/site?
Thanks!  

(1) There are no shell script extensions -- anything that is in place is just to be nice.
 
(2) There are none, since extensions aren't used.

(3) Oh, you mean shells!

(4) best is internet -- there's one ... shell programming gems, let me see what I can find.
      http://www.spy.org/programming/sh/as-txt

Basically, the command interface for unix... is called a shell -- but really this "shell" is just
a way to launch commands.  Shells can be brain-dead simple, or they can get overly-complex.

Traditionally, unix has had "sh" for root and system accounts and scripts, but you will see
that linux is probably using bash and I think freebsd is using tcsh (for root's shell) -- but
most scripting is done using /bin/sh -- because it's pretty standard.  Of course, /usr/bin/perl
is also pretty standard -- although I remember when it wasn't, etc.

If you program in plane-jane "sh" (no ksh extensions, etc) ... you might be able to get some
cross platform compatibility -- but it isn't guaranteed.

sh is decent for programming, but is severely lacking in some areas such as math and
advanced data types (ie: arrays?) ... csh is more user friendly than sh for interactive use,
but it's really a mess for programming.  I don't think anyone really programs in csh,
although I did write a BBS once in tcsh.

I have used tcsh for my shell since the late 80s....but I've been meaning to switch over to
zsh.   I'm starting to put zsh into use on different machines now, but zsh may not be
installed "standard" on many machines -- the same is probably true os tcsh.

There are many other "shells" out there -- and you could even make your own.  Just
about any program that has a command interpreter in it could probably be used as a
shell (ie: I know someone who had emacs as their login shell -- and I had perl as my
login shell for a while... recently I was looking into Ch as my login shell).

As far as programming, the net is probably the best resource to find examples of
programs.  There are few gotchas with sh programming compared to other languages
(ie: setting var values a while loop doesn't work -- sometimes -- because a child
can't affect the parent [without a specific arrangement to do so]).

Feel free to ask questions here if you are stuck with something regarding shell programming.

Scott

obscurite

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Zaurus Linux Shell Scripting Questions
« Reply #4 on: December 17, 2004, 03:33:33 pm »
Scott - re: perl shell

Did you have your login shell run perl -e? Was it actually useful? How'd it work? Fun.

-Daniel
C3100, 5500, former C860 owner