Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Help on filename generation



Peter Stephenson <pws@xxxxxxx> writes:

> Peter Stephenson wrote:
>> Joel J. Adamson wrote:
>> > function doit() {
>> >    for file in $1/*(generic)*~*(~)
>> >    print $file
>> >    exit
>> > }
>> > 
>> > Currently I get "doit:1: unknown file attribute."   When I enter this
>> > globbing pattern at the interactive prompt, I get the files I want.
>> 
>> The pattern should be:
>> 
>>  $1/*generic*~*\~
>
> I've also just looked at the rest of the function and noticed:

Oh, since you seem eager to help, that's not the function -- this is
the function:
----------------------------------------
function doit() {
   for file in $1/*(generic)*
       # no backup files $1/data/*(generic)*~*(~)
       do
       filename=${file##$1}
       newfilename=${filename/\/generic/$title}
       cp $file ./$newfilename
       ci -u -zLT $newfilename	
       chgrp biostat ./$newfilename	# how do I make this the default behavior?
     done

     if [[ -a ${title}Makefile ]]; then
  	mv ./(generic|$title)Makefile ./Makefile
     else
  	print No Makefile found
     fi

     if [[ -a $1/data/wilens.bib ]]; then
 	ln -s $1/data/wilens.bib
     fi
    
     exit 0
 }

----------------------------------------

You'll notice that (a) I changed the second line so that I could
actually get my work done and (b) other areas need work.  Particularly
the ci puts me into the RCS logging prompt; I would rather just not
enter a message.  Is there an option for ci that will just check in
the file, without asking me for a description?  In general, how do I
answer an interactive prompt within a shell function (i.e.,
non-interactively)?

Thanks,
Joel


-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

*Getting unexpected output from Word?
http://www.youtube.com/watch?v=9sZtriK9rKQ&NR=1

*Try LaTeX: it's free, easy and professional
http://www.edafe.org/latex/
http://en.wikipedia.org/wiki/LaTeX
http://nitens.org/taraborelli/latex





The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.



Messages sorted by: Reverse Date, Date, Thread, Author