execline and $0-based stuff

From: <gperreal_at_free.fr>
Date: Sat, 18 Feb 2017 13:46:20 +0100 (CET)

Hello there,

I would like to extract a part of the path of the executed script ($0) in a variable, e.g. if the script was run as /some/path/getty-tty1/run, I would like to extract "tty1" from the path, or similary, extract "dropbear" from /some/path/dropbear-log/run. This would allow to write templated services quite easily using symlinks. However, I noticed there is no substitution nor sed equivalent in the execline/s6 tool suite ; even a grep-like tool that output capturing groups would do the trick. I think it would be doable with the existing set of tools but would be quite heavy.

Does anyone have an idea about this ?

Best regards,
-- 
Guillaume. 
Received on Sat Feb 18 2017 - 12:46:20 UTC

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