Bacula-users

Re: [Bacula-users] Job canceling tip

2013-03-05 10:37:49
Subject: Re: [Bacula-users] Job canceling tip
From: Konstantin Khomoutov <flatworm AT users.sourceforge DOT net>
To: Dan Langille <dan AT langille DOT org>
Date: Tue, 5 Mar 2013 19:35:05 +0400
On Tue, 05 Mar 2013 09:54:06 -0500
Dan Langille <dan AT langille DOT org> wrote:

[...]
> > A portable way to do the same is to use the `seq` program
> >
> > for i in `seq 17 21`; do ...
> >
> > or to maintain an explicit counter:
> >
> > i=17
> > while [ $i -le 21 ]; do ...; i=$(($i+1)); done
> 
> Then I tried this approach but didn't find seq at all.  I tried sh, 
> csh, and tcsh.
> 
> But I know about jot.  This does 5 numbers, starting at 17:
> 
> $ jot 5 17
> 17
> 18
> 19
> 20
> 21
> 
> Thus, the script becomes:
> 
> $ cat test.sh
> #!/bin/sh
> 
> for i in `jot 5 17` ; do echo cancel yes jobid=404${i} ; done
> 
> 
> $ sh ./test.sh
> cancel yes jobid=40417
> cancel yes jobid=40418
> cancel yes jobid=40419
> cancel yes jobid=40420
> cancel yes jobid=40421

Okay, it's a slip on my part: seq appears to be a GNU-ism (it's a part
of its "coreutils" [1] package and hence could be expected to be present
on any sensible system based on Linux).  Conversely, jot is not to be
commonly expected on GNU/Linux systems -- for instance, in Debian, it's
available as a separate package "athena-jot", and its source download
location [2] hints that it's a part of some MIT project codenamed Athena
(not sure if it's that one related to X or something other).

Hence I would say using an explicit counter is the only truly portable
method.  At least with POSIX shells.

1. http://www.gnu.org/software/coreutils/
2. 
http://packages.debian.org/changelogs/pool/main/a/athena-jot/athena-jot_9.0-5/copyright

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>