[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sh script Q



Quoth Oleg Goldshmidt on Wed, Jun 09, 1999:
> test -w foo && do_sth_with foo
> 
> looks more readable than
> 
> [ -w foo ] && do_sth_with foo

For me, [ ] looks more readable, mostly because it has visible
boundaries.

> and is only 1 char longer, and is shorter than 
> 
> if [ -w foo ]; then do_sth_with foo; fi

And 'if' looks even more readable, especially when indented
properly (K&R C style):

if [ -w foo ]; then
	do_sth_with foo
fi

Vadik.

-- 
Prof:    So the American government went to IBM to come up with a data
         encryption standard and they came up with ...
Student: EBCDIC!