execline: returning something from ifthenelse blocks

From: Profpatsch <mail_at_profpatsch.de>
Date: Wed, 25 Jul 2018 01:47:17 +0200

I have the following logic:
If file in variable f is a symlink, resolve it
and use the result as link target.
Otherwise, use the result as link target directly.

So I’d like to have an ifthenelse and return the
same envvar from both branches. But this is the
best I can do:

ifte {
  backtick res { s6-linkname -f $f }
  importas -ui res res
  s6-ln $res $origin
} {
  s6-ln $f $origin
}
{ s6-test -L $f }

My hope would be something like:

ifthenelse { s6-test -L $f } {
  return $res somehow
} {}
s6-ln $res $origin
    

-- 
Written with Emacs (mu4e) on NixOS.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es/
May take up to five days to read your message. If it’s urgent, call me.
Received on Tue Jul 24 2018 - 23:47:17 UTC

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