GOT IT!!! Cp "$variable"*
Thanks again! -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of James Mohr Sent: Monday, October 14, 2002 3:58 PM To: [EMAIL PROTECTED] Subject: Re: Variable Quoting On Monday 14 October 2002 20:38, Paul Kraus wrote: <SNIP> > Now with this change > string="My Documents/*" > cp "$string" /tmp > > cp: cannot stat 'My Documents/*':no such file or directory Sure because the token that is passed to the cp command includes the asterisk, it doesn't know that it should expand the asterisk (*) to the file names, so it looks for a file with the literal name '*'. > So then I for kicks I tried. > > cp "My Documents/*" /tmp > Produces the same error. Same thing. > > So just to make sure that it was not a typo in path I tried. cp My\ > Documents/* /tmp > > And this worked. Makes sense as the shell is now expanding the asterisks to the names of the files. You don't see this because it is expanded internally. Create a shell script that just does this copy and put "set -x" on the first list. This should show you the expanded form before it is passed to cp. > So is the problem with cp? Since the same syntax seems to work with > all other apps? Is cp not capable of taking a double quoted path with > spaces? No, it is the fact that cp does not know to expand the asterisk. Plus you are passing different things to the cp depending on what sets of quotes you use. > Redhat 7.3 in case it helps. Actually the Linux distriubtion is pretty irrelevant in this case. In fact the behavior would be the same on most any *NIX system, as it is standard shell stuff. See if these explain more of the details for you: http://www.linux-tutorial.info/cgi-bin/display.pl?20&0&0&0&3 http://www.linux-tutorial.info/cgi-bin/display.pl?22&0&0&0&3 regards, jimmo -- --------------------------------------- "Be more concerned with your character than with your reputation. Your character is what you really are while your reputation is merely what others think you are." -- John Wooden --------------------------------------- Be sure to visit the Linux Tutorial: http://www.linux-tutorial.info --------------------------------------- NOTE: All messages sent to me in response to my posts to newsgroups or forums are subject to reposting. - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs
