On 2013-04-04,
Avoi...@gmail.com <
Avoi...@gmail.com> wrote:
> In article <kji5s8$31t$
5...@dont-email.me>, J G Miller <mil...@yoyo.ORG> wrote:
>
>> On Wednesday, April 3rd, 2013 20:11:33 +0000, Chris Glur pondered:
>>
>> > Is bash.sh compiled or interpreted?
>>
>> Bourne shell, bash shell, ksh, zsh, csh, tcsh etc scripts
>> are all interpreted.
>>
>> In your Bourne shell script put ``set -x'' at the top after the line
>>
>> #! /bin/sh
>> set -x
>>
>> and you will see the script executed, line by line.
>
> Without testing it:
Perhaps you should test it and see what happens? Why in the world are
you theorizing about how it works, when an experiment (see above) is so
so easy to carry out.
><statements/commands> can extend over lines,
> so <lines> can't execute atomically.
>
> Since the <statements/commands> are potentially
> nested, that further precludes line by line execution.
No it does not.
>
> PLEASE boys! focus on the specific smtp.sh
You are the one interested in figuring it out, but you are unwilling to
put in any effort to learn. Why should anyone else waste any time on it?
>
> cat>/mesgFile
> (
> read line 0<&3 ; echo "$line">$log case "$line" in 2*) ;; *) echo
> "QUIT" 1>&3 ; exit 0 ;; esac echo "HELO $local_name" 1>&3
> ...55 similar lines ...
> ) 3<>/dev/tcp/$smtp_server/25
>
> Based on Joe Beanfish's input,
> it seems that the '(bracketed lines)' constitute a
> nested-statement.
No.
for bash, parentheses around a set of commands means "start up an new
version of bash and feed the commands in the parentheses to that new
version of bash to interpret and execute.
>
> My main concern is whether the redirection: `3<>...`
> 'belongs' to the '(bracketed lines)' SPECIFICALLY.
It "belongs" to that new version of bash that is started by the
parentheses.
> And if so I'm waiting for a comment on my observation
> that since the () could be a zilllion lines, it's a crappy
> syntax to have the 'initialisation' at the END.
Initialisation of what?
And the above would be a crappy way of writing a shell script in bash,
for exactly the reason you indicate. And if it really were a zillion
lines, you would run out of memory to hold the program, and your system
would first swap itself to death, and then perhaps crash. On the other
hand, if you stuck those zillion commands into a file, bash could then
do the redirections and read the lines one at a time.
>
> And obviously the script can't interpret/run line-by-line,
> because it can't know what to do until the last line -- in
> this case.
No. It would read in everthing between the parentheses stick it into
temporary storage until it got to the end of the implicit bash command,
did the redirection, and then went through the program line by line and
interpreted it.
>
> WDYS?
>