On Mon, Jul 19, 2010 at 2:53 AM, Linda Walsh <b...@tlinx.org> wrote:

>
>
> from man bash, to define a function use;
>
> "function" "name" <compound-command>
>  OR
> "name" () <compound-command>
>
> right?
>
> And Compound Commands are:
>
>  ( <list>)
>  { <list>; )
>  (( expression ))
>  [[ expression ]]
> ...et al....
>
> so why do I get a syntax error for
>
> function good_dir [[ -n $1 && -d $1 && -r $1  && -x $1 ]]
>
> bash: syntax error near unexpected token `[['
>
> You should enclose the function body code in between `{' and `}':

function good_dir { [[ -n $1 && -d $1 && -r $1  && -x $1 ]]; }

Reply via email to