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 -- Huella de clave primaria: 0FDA C36F F110 54F4 D42B D0EB 617D 396C 448B 31EB
signature.asc
Description: Digital signature