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

Re: Q re: if test of command in bash script



Chris Jones wrote:
> if mkdir; then 
> 	echo 'created OK'
> else
> 	echo 'not created OK'
> 	exit 1
>
>
> ... the [] is redundant, IOW:
>
> if test mkdir 		# ???
>
> also your sample has the then/else actions inverted.
>   

Thank you. I thought I had tried it without the brackets, but I must've
introduced some other little problem when I tried it 'cause it works now.

Steve Kemp suggested:

> if ( mkdir -p $targetDir ) 

Do the parenths add any value? (meaning? readability? it seems to me to
add readability)

Thanks!


-- 
Kent West     <*)))><
http://kentwest.blogspot.com


Reply to: