[systemd-devel] [PATCH 12/12] Add mock fsck process

Martin Pitt martin.pitt at ubuntu.com
Wed Jan 28 08:13:04 PST 2015


Zbigniew Jędrzejewski-Szmek [2015-01-28 16:08 +0100]:
> > +#!/bin/bash
> I think you can change this to /bin/sh, I don't see any bashisms.
> 
> > +declare -a maxpass=(30 5 2 30 60)

I do :-) POSIX shell doesn't have arrays AFAIK, and declare -a
definitively doesn't work in e. g. dash.

> > +for pass in {1..5}; do
> > +    maxprogress=${maxpass[$((pass-1))]}

That said, if using POSIX shell is a concern (probably not for this
little test dummy), this could certainly be rewritten to something
like

  pass=0
  for maxprogress in 30 5 2 30 60; do
      pass=$((pass+1))

which isn't really more complicated and avoids arrays.

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


More information about the systemd-devel mailing list