Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Command touch and irregular file names

From: Ken Irving <fnkci(at)uaf.edu>
Date: Wed Aug 15 2007 - 00:57:05 EDT


On Tue, Aug 14, 2007 at 08:54:33PM -0400, - Tong - wrote:
> Hi,
>
> How to let command touch to work with irregular file names?
>
> In my script I have
>
> touch -r "$file1" "$file2"
>
> the file1/2 can be anything file, ../path/file, /root/file, etc.
>
> The problem is when file1/2 are irregular file names. E.g., -test.file1/2.

I've always had trouble with leading dashes in file names, very difficult to escape properly or sufficiently. An alternative might be to do the operation from a perl (or whatever language) script.

Ken

>
> I.e., anyway to make the following touch command works?
>
> $ touch -r "-test.file1" "-test.file2"
> touch: invalid date format `est.file2'
>
> FYI, I tried this but didn't work:
>
> $ touch -r -- "-test.file1" "-test.file2"
> touch: invalid date format `est.file1'
>
> I think if the touch command uses the standard gnu getopt lib, then
> the above code should work, shouldn't it?
>
> Thanks
>
> tong

-- 
Ken Irving, fnkci@uaf.edu


-- 
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Received on Wed Aug 15 00:57:37 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 02:11:40 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library