delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/29/11:00:37

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Matthias Meyer <matthias DOT meyer AT gmx DOT li>
Subject: read file with windows filenames
Date: Thu, 29 Jan 2009 17:00:02 +0100
Lines: 34
Message-ID: <glsjq7$6fv$1@ger.gmane.org>
Mime-Version: 1.0
User-Agent: KNode/0.10.9
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hi,

I want to read filenames from a file and manipulate this files with the windows program "attrib".
Not easy to find how to read windows filenames from a file without lost of "\".
while IFS= read -r cLine
do
        echo "$cLine"
done < restoreFiles.tmp

The above will work. BUT:

while IFS= read -r cLine
do
        echo "$cLine"
        attrib +H "$cLine"
done < restoreFiles.tmp
rm -f restoreFiles.tmp

will stop the while loop after the first call of attrib:

+ echo 'C:\Dokumente und Einstellungen\Administrator\Anwendungsdaten\Microsoft\Credentials\S-1-5-21-1606980848-1532298954-1801674531-500'
C:\Dokumente und Einstellungen\Administrator\Anwendungsdaten\Microsoft\Credentials\S-1-5-21-1606980848-1532298954-1801674531-500
+ attrib +S 'C:\Dokumente und Einstellungen\Administrator\Anwendungsdaten\Microsoft\Credentials\S-1-5-21-1606980848-1532298954-1801674531-500'
+ IFS=
+ read -r cLine
+ test 0 -gt 0
+ rm -f restoreFiles.tmp

Did anyone know what happens there?

Thanks for any hint
Matthias
-- 
Don't Panic


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019