1 |
On 5/29/06, Bo Ørsted Andresen <bo.andresen@××××.dk> wrote: |
2 |
> |
3 |
> Tuesday 30 May 2006 06:48 skrev Iain Buchanan: |
4 |
> > I see this [ "x" != "x$BLAH" ] test all over the place, especially in |
5 |
> > the /etc/init.d scripts. Maybe -z is not standardised or something? |
6 |
> > Dunno why people use it. |
7 |
> |
8 |
> Having searched a little further I have been able to locate a few scripts |
9 |
> that |
10 |
> uses this in my bin folders. Common for those scripts are that they are sh |
11 |
> scripts and not bash scripts. Looking at 'man sh' you find no -z or -n but |
12 |
> they are in 'man bash'. |
13 |
> |
14 |
> I think it's safe to say that .bashrc is a bash script and to make it even |
15 |
> more amusing (or whatever) Kevin does use both -z and -n a little further |
16 |
> down in his script. |
17 |
|
18 |
|
19 |
All true. I do translations like this when I want to make it clear what's |
20 |
going on. |
21 |
I worry that in the future seeing a test on "$PS1" will baffle me, even if I |
22 |
wrote |
23 |
it. So I create a variable whose name indicates the motivation. I'm never |
24 |
going to save enough time optimizing a .bashrc script to pay for one |
25 |
minutes' |
26 |
worth of floundering later on. |
27 |
|
28 |
I have no defense for the variance in coding style. I didn't notice it so I |
29 |
didn't |
30 |
change it. I may still not do so -- I don't see the point. |
31 |
|
32 |
It's a matter of taste. |
33 |
|
34 |
++ kevin |
35 |
|
36 |
-- |
37 |
Kevin O'Gorman, PhD |