Re: [Bashburn-info] Copy Data CD to CD Issues
Brought to you by:
bashburn
From: Steven W. O. <st...@sy...> - 2008-10-01 14:59:57
|
On Wednesday, Oct 1st 2008 at 09:53 -0000, quoth Fabian Stietzel: =>Steven W. Orr wrote: =>> * The copy command is using globbing. Globbing is evil. We need to only =>> copy files that are explicitly specified. If you copy by saying something =>> like... =>> =>The shell is globbing. cp will never do it. It's the shell. The globbing =>can be avoided easily by using single quotation marks. => =>> cp dir/* somewhere/ =>> =>> Then there's no way to detect that the cp didn't pick something up. We =>> have to either verify that the disk is mounted and/or we have to always =>> specify explict files. DEATH TO GLOBBING. =>> =>> =>Of course you can detect if cd "didn't pick something up". cd will pick =>every file supplied as a command line argument before the last (target). =>if someting goes wrong the return value/exit code of cd will not be 0. =>the shell does the globbing, thus instead of 'dir/*', 'dir/a' 'dir/b' is =>supplied to cp as command line argument if 'dir/a' and 'dir/b' exist. => =>If you do something like 'cp dir/* somewhere/' you will get an error if =>'dir/' is empty. This is because if 'dir/' is empty the shell will not =>do globbing for the asterisk. So cp will complain that it can't find the =>file 'dir/*'. I think before doing major changes here...maybe somebody =>just forgot to check $? after the cp invocation. => => =>Just my 2 cents, =>Fabian Thanks Fabian. Certainly worth checking. Nick, do you know what code we're talking about here? Where is this cp command in question? -- steveo at syslang dot net TMMP1 http://frambors.syslang.net/ Do you have neighbors who are not frambors? Steven W. Orr |