According to Nagle, Adrian: While burning my CPU.
> 
> If there is a more appropriate place to ask about bash, please let me know.
> 
> I'm starting to learn how to use bash.  For a start, I want to write a
> script that copies some .html files from /floppy to a ~/public_html
> directory, change to permissions, user, and groups appropriately and delete
> the files in /floppy after this is done.

The funtion fromdos is invalid, but why do it like that, command line would
be;
cp /floppy/*.html /home/anagle/public_html
chown -R anagle /home/anagle/public_html/*.html
etc
etc

So you could start making a script for the commands above.

if [ -f /floppy/*.html ]; then
 cp /floppy/*.html /home/angle/public etc etc etc

> 
> Part of my attempt:
> cd /floppy
> 
> if [-e /floppy/*.html]; then
>   for filename in $*
>     fromdos < $filename > $HOME/public_html/$filename
>     chown anagle $HOME/public_html/$filename
>     chgrp users $HOME/public_html/$filename
>     chmod 644 $HOME/public_html/$filename
>     rm $filename
>   done
> else
>   echo "No HTML files are located in $PWD./nNothing done."
                                           ^^^ this will not interpret a
carrige return.

echo -e "No HTML files are located in $PWD.\nNothing done."

Note the echo -e option and the slash "\" not "/"

You could make the script for "general" use, ie, with command line arguments
for source and destination directorys.


> fi
> 
> I get a "token" error on the line with 'fromdos'.  I was thinking of perhaps
> using 'ex' or something similar.  Also, I don't know if I'm using the '$*'
> correctly.
> 
> Thanks for the help.
> 
> Adrian
> -- 
> Adrian Nagle             Ball Aerospace & Technologies Corp.
> Thermal Engineer                               P.O. Box 1062
> TEL: 303-939-6518                    Boulder, CO  80306-1062
> FAX: 303-939-5166               http://www.ballaerospace.com
> 


-- 
Regards Richard.
[EMAIL PROTECTED]

Reply via email to