Let's get to the core problem

Eric A. Ayer mwalker at ee.pdx.edu
Tue Jun 27 08:29:55 PDT 2000


>> A lot of the installation of the various packages comes down to running
> shell
>> commands.  Granted, a shell script is not the answere to the entire
> process of
>> the install, but a lot of things may come down to being shell scripts.
> One
>> possibility I see is that the commands in the shell scripts could be run
> one
>> by one in a sort of single step mode, so the user can see and/or change
> what
>> will be run.  I can imagine something like an "ncurses screen" showing the
>> commands for configuring, making, etc, either just as they are running or
> in
>> interactive mode.
>>
> How about a general purpose bash debugger
> 
>> Lately, I have been working on my own set of install scripts.

> Are they available on line?
> Can we work together?
> My scripts are at:
> http://www.reika.demon.co.uk/index.html

Sorry for not getting back to this earlier.  I will try to get these scripts
posted here (not much to them yet), and then perhaps we can swap some ideas.
Been a little bust with IP chains (and work), but I'll try to get back to the
scripts soon.

>> Related to this last item, I have a shell programming question.  I wanted
> to
>> write a shell function to copy directories from one place to another
> recurs-
>> ively, creating sub-dirs as needed and checking for overwrites.
> 
> I was too lazy to write one:
> cp
> -b --backup    make backup before removal
> -f --force     remove existing desitinations, never prompt
> -i --interactive
> -r             copy recursively, non-directories as files
> -R             copy recursively
> 
> 
>> I found that shell functions can't be recursive,
> 
> I found they could be recursive. See "help local", and watch out
> for the unusual behaviour of the induction variable of a for loop.
> 
>> so I need to get a directory listing into a shell variable and step
> through
>> each item.  Easy enough to create the variable - dirvar=`ls`.  But how do
> you
>> get one item out of that variable?  I remember doing this before, sucking
> out
>> one word from the variable, but I can't remember how.  Any ideas?
> 
> $(ls | cut ...) has been metioned and gets you one, but as your source is
> ls,
> perhaps you would prefer:
> for file in $(ls $1); do
>   echo $file
> done
> 
> Richard

That looks promising (makes sense too).  If $file turns out to be a directory,
can I recursively call this function?  All shell variables are global, which
means I have to be real careful.  Are the passed parameters local?  Does $1 in
one iteration of a function equal $1 in another iteration?

					-Erik

--
Mail archive: http://www.pcrdallas.com/mail-archives/alfs-discuss
IRC access: server: irc.linuxfromscratch.org port: 6667 channel: #LFS
Unsubscribe: email alfs-discuss-request at linuxfromscratch.org and put
"unsubscribe" (without the quotation marks) in the body of the message
(no subject is required)



More information about the alfs-discuss mailing list