shell

shell

Post by Pete » Sun, 22 Oct 2000 04:00:00



Can someone give me a description of how sh parses a command such as

ls -l | wc -l > out
cat < junk

?

I'm not looking for actual code. I'm just looking for some kind of
algorithm to follow
since I'm trying to make a shell that will handle commands such as the
above. I'm
somewhat familiar with fork(), pipe(), etc. but I'm not sure
how the parse should work.  Any suggestions other than download the
source code for sh?

Thanks,

- Pete

 
 
 

shell

Post by Barry Margoli » Tue, 24 Oct 2000 04:00:00




>Can someone give me a description of how sh parses a command such as

>ls -l | wc -l > out
>cat < junk

>?

>I'm not looking for actual code. I'm just looking for some kind of
>algorithm to follow
>since I'm trying to make a shell that will handle commands such as the
>above.

Read the sh(1) man page.  It goes into some detail about how a command line
is parsed into simple commands, pipelines, and lists.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

1. Bourne Shell compatible shells (was: Request: which shells)


Me too :-)

I also had some problems with smail and make depend. Don't remember how I
fixed them.

I also detected two other problems with bash 1.12:

 - it wouldn't run the Configure script of trn 3.0 (beta). This will be
   fixed in bash 1.13, but the Configure script has already changed so that
   it works with bash 1.12 too.

 - it does something wrong with passing $* from other shell scripts which are
   included by the `.' command. I detected this when INN 1.4 rejected all
   newgroup messages.

The pdksh I have (4.7) is absolutely unuseable for running Configure
scripts. Try the following script with pdksh 4.7 with two or more parameters:

        #!/bin/ksh

Zsh gives also problems with Configure scripts.

I use tcsh as interactive shell and bash as /bin/sh substitute because bash
is the more-or-less Bourne shell compatible shell which runs most of the
(Configure) scripts I have.  Running Configure scripts (sometimes >100Kb) is
a real good test for testing /bin/sh compatibility of shells.

Arjan

--


2. ./kernel bad cookie??

3. shells shells shells

4. Linux 2.4-based systems won't boot on SiS-based motherboard

5. handling SIGINT in shell scripts when executing another shell script.

6. An exciting Linux project

7. UNIX shell differences and how to change your shell (Monthly Posting)

8. videoconferencing on Linux

9. killing a shell that has a running child shell

10. Changing from the Bourne shell to C-shell

11. UNIX shell differences and how to change your shell (Monthly Posting)

12. Trying to run nohup from Korn shell but getting Bourne shell errors