metavar - Create a number of meta variablesΒΆ

Set a number of meta variables to be used in job configuration. Variable that are currently created are:

(Assuming we’re in the directory: /tmp/this/is/a/test)

_
name of the current directory. In the example, _ renders to test
__
name of the parent directory - (example: a)
___
name of the parent directory - (example: is)
dir1
same as _
dir2
same as __
dir3
same as ___
dir4
parent directory of dir3

Also a number of contextual variables are defined. In the same example as above, based on the directory name, the following variables are defined:

  • __tmp: /tmp
  • __this: /tmp/this
  • __is: /tmp/this/is
  • __a: /tmp/this/is/a
  • __test: /tmp/this/is/a/test

Note that numerical prefixes are stripped from directoy names. So, for example: /tmp/this/10.is/444.a/test would result in the same variables names as mentioned above (but with different directories). Also, [^A-Za-z0-9_] in variable names are converted to underscores to become valid python variable names.

(for backwards compatibility - _tmp versions are also defined with the same value)

Additional contextual variables are, based on the following example directory structure (with cwd being /tmp/test/20.dirc/20.subb/:

/tmp/test/00.dira/
/tmp/test/10.dirb/
/tmp/test/20.dirc/
/tmp/test/20.dirc/10.suba/
/tmp/test/20.dirc/20.subb/
/tmp/test/20.dirc/30.subc/
/tmp/test/20.dirc/40.subd/
/tmp/test/30.dird/

_f: 10.suba _p: 10.suba _n: 30.subc _l: 40.subd

__f: /tmp/test/20.dirc/10.suba __p: /tmp/test/20.dirc/10.suba __n: /tmp/test/20.dirc/30.subc __l: /tmp/test/20.dirc/40.subd

_ff: 00.dira _pp: 10.dirb _nn: 30.dird _ll: 30.dird

__ff: /tmp/test/00.dira __pp: /tmp/test/10.dirb __nn: /tmp/test/30.dird __ll: /tmp/test/30.dird

Equivalently, ___first, ___prev, ___next and ___last are also defined.

Note that all directory orders are based on an alphanumerical sort of directory names. 9.dir comes after 10.dir. (so use 09.dir).

The latter definitions override the earlier ones.

Previous topic

moa.plugin

Next topic

adhoc - create jobs from adhoc bash code