If you're writing a Bash-specific script then it's preferable to use double square brackets (see http://mywiki.wooledge.org/BashFAQ/031).
if [[ -f $file ]] then do something fi I prefer forms using the fewest number of semicolons, but I really don't think it matters. Consistency is more important. On Mon, Aug 23, 2010 at 4:29 PM, Peng Yu <pengyu...@gmail.com> wrote: > Hi, > > I'm wondering if there is a widely accepted coding style of bash scripts. > > lug.fh-swf.de/vim/vim-bash/StyleGuideShell.en.pdf > > I've seen the following style. Which is one is more widely accepted? > > if [ -f $file]; then > do something > fi > > if [ -f $file]; > then > do something > fi > > -- > Regards, > Peng > >