Encoding multiple filenames in a single variable

2010-08-29 Thread Jon Seymour
This isn't strictly a bash question, and I'd prefer a POSIX-only
solution if possible [ suggestions as to a good question to ask
POSIX-only questions would be appreciated ].

Suppose I need to encode a list of filenames in a variable and each
filename may contain spaces, what is good way to encode such a list so
that the resulting variable is readily compose-able and decodeable? In
particular, I'd like to avoid the use of (unescaped) separators which
might themselves be used in the filename.

jon.



Re: Encoding multiple filenames in a single variable

2010-08-29 Thread Jon Seymour
| question -> _forum_

On 8/29/10, Jon Seymour  wrote:
> This isn't strictly a bash question, and I'd prefer a POSIX-only
> solution if possible [ suggestions as to a good _forum_ to ask
> POSIX-only questions would be appreciated ].
>
> Suppose I need to encode a list of filenames in a variable and each
> filename may contain spaces, what is good way to encode such a list so
> that the resulting variable is readily compose-able and decodeable? In
> particular, I'd like to avoid the use of (unescaped) separators which
> might themselves be used in the filename.
>
> jon.
>



Re: Encoding multiple filenames in a single variable

2010-08-29 Thread Chris F.A. Johnson

On Sun, 29 Aug 2010, Jon Seymour wrote:


This isn't strictly a bash question, and I'd prefer a POSIX-only
solution if possible [ suggestions as to a good question to ask
POSIX-only questions would be appreciated ].


  The comp.unix.shell newsgroup is a good place.


Suppose I need to encode a list of filenames in a variable and each
filename may contain spaces, what is good way to encode such a list so
that the resulting variable is readily compose-able and decodeable? In
particular, I'd like to avoid the use of (unescaped) separators which
might themselves be used in the filename.


   Either separate them with newlines, or (non-POSIX) use an array.

## POSIX
NL='
'
files=${files:+$files$NL}$nextfile

## Array
files+=( "$nextfile" )

--
   Chris F.A. Johnson, 
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)



Re: Encoding multiple filenames in a single variable

2010-08-29 Thread Andre Majorel
On 2010-08-29 17:12 +1000, Jon Seymour wrote:

> This isn't strictly a bash question, and I'd prefer a POSIX-only
> solution if possible [ suggestions as to a good question to ask
> POSIX-only questions would be appreciated ].

comp.unix.shell

> Suppose I need to encode a list of filenames in a variable and each
> filename may contain spaces, what is good way to encode such a list so
> that the resulting variable is readily compose-able and decodeable? In
> particular, I'd like to avoid the use of (unescaped) separators which
> might themselves be used in the filename.

Depends. Where do those file names come from and how are they
used ? Command line arguments ? File descriptor ? Separated by
NULs or newlines ? One by one or all at once ?

-- 
André Majorel http://www.teaser.fr/~amajorel/



Translating a shell script

2010-08-29 Thread Christopher Roy Bratusek
Hi all,

I'm struggling around at translating a shell script. Well I've set it up, the 
pot file
contains all strings, the german .po file is finished, but: the strings won't 
show up...

Actually it's just a test how good translation works for shell-scripts. (It's 
an huge
amount of strings I would have to mark and translate). Currently only the file 
"rc/nx-rc"
(build from rc/nx-rc.in by configure) from this project is set-up for 
translation:

git clone git://git.tuxfamily.org/gitroot/bashstyleng/bashstyleng.git

creating the pot files:

./configure
make pot

update the po files:

make po

build files:

make

... one would start "bashstyle" and hit "Enable BashStyle" checkbox and then 
start a new
bash session (...) Check the README or documentation/index.html if you want to 
know
what's this all about. The text flying by is still english, rather than german.

Any help is appreciated.

Regards,
Chris