Shell script execution methodology

Shell script execution methodology

Post by Ron Isaacs » Fri, 19 Jul 1996 04:00:00




> I thought that UNIX would take a copy of the entire script when the
> script is executed and store it in memory, but it looks as though each
> line is fetched from the script file as needed.

As I understand it, shell scripts work like DOS batch files, if that
means anything... it reads one line from the file, placing the file
marker at the beginning of the next line. It figures out what offset
into the file that is and saves it. Then it executes the line, seeks
to the saved position in the file and repeats the process. Therefore,
if you change a script on the fly, the changes you make to any lines
not yet executed will be reflected when they are executed. The worst
problems with this usually occur when you add or remove characters in
the running shell script at a point before the saved position. Then
the saved position often ends up in the middle of a line, either ahead
of or behind where it really should be.


        http://www.seas.upenn.edu/~isaacson/

 
 
 

Shell script execution methodology

Post by Stuart Jacks » Fri, 19 Jul 1996 04:00:00


I have a shell script running on a Solaris 2.3 platform.  The script
checks to see if a particular file exists.  If it doesn't exist then
the script sleeps for 24 hours then checks again.  This loop is
repeated until the file is detected, then the script continues.

The script had been running for a couple of days when I changed the
shell script on the hard disk.  This led to odd behaviour in the
script that was currently running.

I thought that UNIX would take a copy of the entire script when the
script is executed and store it in memory, but it looks as though each
line is fetched from the script file as needed.

Can anyone give me a definitive answer on this?

Thanks in advance.
Stuart Jackson

 
 
 

Shell script execution methodology

Post by Bryan O'Sulliv » Fri, 19 Jul 1996 04:00:00



s> I thought that UNIX would take a copy of the entire script when the
s> script is executed and store it in memory, but it looks as though
s> each line is fetched from the script file as needed.

It's up to the shell itself to deal with this.  Some shells will read
line by line as needed, and others will read the entire script at
startup time.

You shouldn't rely on some particular kind of behaviour.

        <b

--
Let us pray:
What a Great System.
Please Do Not Crash.

 
 
 

1. Execution of SQL Script thru shell script

hi all,
I have a piece of SQL code(some insert statement). Unix server. Oracle
DB.
I need to execute the sql code in the unix shell ... as in as a part
of a batch process...

i have a loginid password... for oracle
i believe that there is some sql command that can be embeded in the
shell script ? ne one aware ?

something like
sqlplus username/password ...
statement to execute sql file...
i need exact syntax...

Any help is appreciated !
regards

2. Sticky bit

3. How Can I control program execution in script shell ?

4. Windows/Linux internet connection sharing.

5. Shell script hangs at execution of Java program...

6. startx monitor shutdown

7. >> Shell Script Execution Question

8. Konquerer's built-in PDF viewer not working...

9. Shell script execution when mail is recieved

10. Conditional execution in a shell script

11. Do comments in Bourne shell scripts slow their execution ??

12. Waiting on end of program execution from shell script?

13. How Can I control program execution in script shell ?