Re: [HACKERS] When scripting, which is better?

2001-10-02 Thread Peter Eisentraut
Justin Clift writes: i.e. if [ -x $self_path/postmaster ] [ -x $self_path/psql ]; then or if [[ -x $self_path/postmaster -x $self_path/psql ]]; then I don't think the second one is a valid expression. ;-) Maybe you were wondering about [[ ]] vs [] -- In Autoconf [] are the quote

Re: [HACKERS] When scripting, which is better?

2001-10-02 Thread Justin Clift
Sorry guys, I didn't realise I actually sent this, it was part of an email I was putting together to achieve consistency in the scripts, but I thought I cancelled it when it got late in the morning. My apologies. Regards and best wishes, Justin Clift Bruce Momjian wrote: Hi all,

[HACKERS] When scripting, which is better?

2001-10-01 Thread Justin Clift
Hi all, Reading through the script files again, there seems to be several different methods of doing the same thing : i.e. if [ -x $self_path/postmaster ] [ -x $self_path/psql ]; then or if [[ -x $self_path/postmaster -x $self_path/psql ]]; then if [ x$foo = x ]; then or if [ $op =

Re: [HACKERS] When scripting, which is better?

2001-10-01 Thread Adrian Phillips
Justin == Justin Clift [EMAIL PROTECTED] writes: Justin if [ x$foo = x ]; then Justin or Justin if [ $op = ]; then Justin or Justin if [ $foo ]; then I'm not the slightest bit a shell expert, but why not :- if [ -z $foo ]; then Is this POSIX/SUS2/whatever ?

Re: [HACKERS] When scripting, which is better?

2001-10-01 Thread Ken Hirsch
Justin Clift wrote: if [ x$foo = x ]; then This is the safest way. It prevents problems when $foo begins with with a - I don't know about your first question, though. ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ?