Re: Conditional define in execline

From: Olivier Brunel <jjk_at_jjacky.com>
Date: Fri, 20 Mar 2015 20:48:22 +0100

Not sure if this is what you mean, but maybe something like this:

#!/bin/execlineb -P
backtick -n A { ifte
 { echo 1 }
 { echo 0 }
 test -e ./foobar
}
import -u A
echo ${A}

On 03/20/15 20:21, Gorka Lertxundi wrote:
> Hi,
>
> Is there an elegant way to achieve a conditional define? something like
> this:
>
> if (test)
> A = 0
> else
> A = 1
>
> do something with A :-)
>
> More or less this is what I tried, and it works:
>
> export fn "\
> ifelse { test }
> {
> define A 0
> \\$_at_
> }
> define A 1
> \\$_at_"
>
> execlineb -S0 -c ${fn}
> s6-echo ${A}
>
> But...I firmly believe that there is a much more elegant way to do this!
>
> Thanks,
>
Received on Fri Mar 20 2015 - 19:48:22 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC