Re: Help translating a bash function to execline

From: Sertonix <sertonix_at_posteo.net>
Date: Mon, 23 Sep 2024 16:22:47 +0000

> I'm trying to make a minimal set of boot services for alpine

I would be interested in the results. Is there simething like a repository?

> if { _at_YELL_INFO_at_ hostname setting hostname }
>
> if -nt {
> backtick opts {
> ifelse { test -s /etc/hostname }
> { echo "-F /etc/hostname" }

You probably want to use -F/etc/hostname instead here. There is no
argument splitting by default in execline so this will be read as the
file name ' /etc/hostname' (notice the leading space). And you can remove
the quotes then.

> importas -uD localhost hostname hostname
> echo $hostname
> }
>
> importas -ui opts opts
> hostname $opts
> }
>
> _at_YELL_ERROR_at_ hostname crashed!

When you are ok with having a hostname call in 2 different locations the
logic can be simplified like this (+ logging wrapper):

ifelse { test -s /etc/hostname } {
  hostname -F /etc/hostname
}
importas -uD localhost hostname hostname
hostname $hostname
Received on Mon Sep 23 2024 - 18:22:47 CEST

This archive was generated by hypermail 2.4.0 : Mon Sep 23 2024 - 18:23:21 CEST