1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
Steve Long schrieb: |
5 |
> René 'Necoro' Neumann wrote: |
6 |
>> cmake-utils_src_enable python => -DENABLE_python=... |
7 |
>> |
8 |
>> Wanted would be that it returned -DENABLE_PYTHON=... |
9 |
>> |
10 |
>> I'm not into bash scripting that much, so I do not know a way to do so - |
11 |
>> but I guess someone else is ;) |
12 |
>> |
13 |
> Unfortunately BASH doesn't support ksh93 or zsh style casting to uppercase. |
14 |
> The best way really is via tr: |
15 |
> alias toUpper='tr [[:lower:]] [[:upper:]]' |
16 |
> alias toLower='tr [[:upper:]] [[:lower:]]' |
17 |
> |
18 |
> (er aliases don't normally work in scripts, but you get the idea.) Bear in |
19 |
> mind that tr reads stdin and writes to stdout. It has the advantage of |
20 |
> being locale-safe. Every other method I've looked at is much slower and |
21 |
> only works with ASCII. |
22 |
> |
23 |
> A function wouldn't be too hard: |
24 |
> toUpper() { |
25 |
> for i; do |
26 |
> echo "$i" |tr [[:lower:]] [[:upper:]] |
27 |
> done |
28 |
> } |
29 |
> |
30 |
> Usage depends on the parameters you pass. |
31 |
> var=$(toUpper $var) # for single vars with no newlines in |
32 |
|
33 |
This is right the version I've chosen ... so with the help of Steve: a |
34 |
small patch ;) |
35 |
|
36 |
Regards, |
37 |
Necoro |
38 |
-----BEGIN PGP SIGNATURE----- |
39 |
Version: GnuPG v1.4.7 (GNU/Linux) |
40 |
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org |
41 |
|
42 |
iD4DBQFHM5uv4UOg/zhYFuARAuELAJjnlDCFDMm3e2mJqYuyT4nkFoaaAJ4go9qp |
43 |
Qca9r8Y7LpD0YSSylUh2BQ== |
44 |
=517n |
45 |
-----END PGP SIGNATURE----- |