Mailinglist Archive: opensuse (2162 mails)

< Previous Next >
Re: [opensuse] BASH gurus - are continuations broken?
  • From: Anders Johansson <ajohansson@xxxxxxx>
  • Date: Sat, 16 Aug 2008 20:06:29 +0200
  • Message-id: <200808162006.29610.ajohansson@xxxxxxx>
On Saturday 16 August 2008 19:13:15 David C. Rankin wrote:
Listmates,

I cannot figure out the differences that the continuations are making in
the following lines of code. It looks like bash isn't handling the
continuations correctly. The block of code doesn't work, the identical
one-liner does. Here is the code:

BASENAME=$(echo $(basename $1 .JPG) | sed -e 's/\"//g' \
-e 's/^\s*//' -e 's/\s*$//' \
-e 's/ /_/g' -e 's/__/_/g' \
-e 's/_-_*/-/g')


BASENAME=$(echo $(basename $1 .JPG) | sed -e 's/\"//g' -e 's/^\s*//' -e
's/\s*$//' -e 's/ /_/g' -e 's/__/_/g' -e 's/_-_*/-/g')

What say the gurus?

You want to enclose the $1 in quotes if you want it to be able to handle files
with spaces in their names, other than that, both versions work fine for me

Anders
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References