X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o- Date: Thu, 17 Mar 2011 19:40:42 -0400 From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com> To: cygwin AT cygwin DOT com Subject: Re: Problems with the new base-files-4.0-5? Message-ID: <20110317234042.GA23720@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4D828E8E DOT 6020607 AT alice DOT it> <20110317230743 DOT GB22548 AT jethro DOT local DOT lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110317230743.GB22548@jethro.local.lan> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: <cygwin.cygwin.com> List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 On Fri, Mar 18, 2011 at 12:07:43AM +0100, David Sastre wrote: >On Thu, Mar 17, 2011 at 11:43:26PM +0100, Angelo Graziosi wrote: >> David Sastre wrote: >> >Please test if >> > >> >[ -e "${p}" ] && read -r PRINTER < "${p}" && PRINTER=${PRINTER%%,*} >> >> No, I think. >> >> I get: >> >> $ cat test_pr.sh >> #!/bin/bash >> >> p='/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows >> NT/CurrentVersion/Windows/Device' >> >> [ -e "${p}" ] && read -r PRINTER < "${p}" && PRINTER=${PRINTER%%,*} >> >> echo 'echo $PRINTER' >> echo $PRINTER >> >> $ ./test_pr.sh >> echo $PRINTER >> HP Deskjet 3740 Series,winspool,Ne03: >> ----------------------^^^^^^^^^^^^^^^ >> which is *wrong*. See ^^^^^^^^^^^^^^^ above! >> >> With base-files-4.0-4 I get: >> >> $ echo $PRINTER >> HP Deskjet 3740 Series >> >> which is right. >> >> Ciao, >> Angelo. > >Thanks for testing. >It looks like it's easier to solve this with a simple if statement. > >p='/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows/Device' >if [ -e "${p}" ] ; then > read -r PRINTER < "${p}" > PRINTER=${PRINTER%%,*} >fi How about: read -r -d, PRINTER < '/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows/Device' I see that "-d" is available in ksh but I don't know about the other shells. cgf -- 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