Re: Bash problems

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Nathan England
Date:  
To: plug-discuss
Subject: Re: Bash problems

This is why I love this list. I didn't think about that. Sometimes you miss
the simple solutions. I modified the script to look like:

find . | tee file_list
while read file
do
cp -ruv "$file" $TMP/backup
...


It works great. Thank you so much!

nathan

On Saturday 12 February 2005 06:38, Lee Einer wrote:
> Nathan England wrote:
> >I am trying to make a script that copies files from one directory to
> > another. The problem is, some files have a space in between the names,
> > think "My Documents"
> >
> >I need a way in bash to copy a file from one directory to another.
> >At the same time, I need to be able to count the files.
> >
> >Currently, I'm trying something like this.
> >
> >find . | tee file_list
> >while read file
> >do
> >cp -ruv $file $TMP/backup
> >done < file_list
> >
> >This works great, but files such as "My Documents" can not be found by cp.
> > It sees it as My and Documents.
> >
> >I thought there was a way to get find to report the space with a leading \
> > but I can't find that and I forgot how I did it before. Can anyone help
> > with this?
> >I greatly appreciate it!
> >
> >Nathan
> >---------------------------------------------------
> >PLUG-discuss mailing list -
> >To subscribe, unsubscribe, or to change you mail settings:
> >http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
> Have you tried actually using double quotes as in "My Documents?" That
> should prevent the shell from reading the whitespace as a separation
> between two distinct terms.

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss