X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,TW_YG X-Spam-Check-By: sourceware.org Message-ID: <4CED13F5.4060605@gremwell.com> Date: Wed, 24 Nov 2010 14:32:37 +0100 From: Alexandre Bezroutchko User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Portable Cygwin: replacing drivename in a text file References: <4CED0E0D DOT 4080106 AT bonhard DOT uklinux DOT net> In-Reply-To: <4CED0E0D.4080106@bonhard.uklinux.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com I'm not the expert on cygwin.exe, but there might be an easier way to solve you problem. For POSIX shell scripts you could keep a symlink /my-usb-stick pointing to /cygdrive/X, and use that symlink in your scripts. Similarly, for Windows batch scripts you keep drive mapping with native Windows 'subst' command. This way you will need to only update the symlink and the drive substitution, not the scripts themselves. Best regards, Alex www.gremwell.com On 11/24/2010 02:07 PM, Fergus wrote: > 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 > -- 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