X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.5 required=5.0	tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,TW_YG
X-Spam-Check-By: sourceware.org
Message-ID: <4CED0E0D.4080106@bonhard.uklinux.net>
Date: Wed, 24 Nov 2010 13:07:25 +0000
From: Fergus <fergus@bonhard.uklinux.net>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: Cygwin ML <cygwin@cygwin.com>
CC: Fergus <fergus@bonhard.uklinux.net>
Subject: Portable Cygwin: replacing drivename in a text file
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Running Cygwin off a portable USB stick.

Different host machines typically allocate a different drivename to the 
stick.

Previous use, say it was J:. A not-quite-portable application needed a 
settings.ini file built with many occurrences of the string 
j:\usr\local\bin. The file was built and saved.

Current use: now it's K:.

I could re-configure settings.ini with
sed -i 's/j:/k:/g' settings.ini
but in general I don't know (and don't want to bother with) what the 
drivename labels were, or are. Something like
sed -i 's/.:\\/ replacementstring /g' settings.ini
will in fact be sufficiently strong to make the change olddriveletter: 
to newdriveletter: where, and only where, I need it, but experiment as I 
might with
replacementstring = cygpath -w
replacementstring = `cygpath -w`
and other variations, I can't get the syntax quite right.

Can anybody help, please? Thank you very much.

Fergus

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

