From 6880a2c1f7b42404c261527ff53518e93213a9b7 Mon Sep 17 00:00:00 2001 From: hygienic-books Date: Thu, 10 Apr 2025 00:56:50 +0200 Subject: [PATCH] feat(role): Add fqdn string massaging functions --- .../bash/bashrc-includes.d/system_linux_func_reverse_fqdn | 4 ++++ .../bash/bashrc-includes.d/system_linux_func_slash_fqdn | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 files/root/.config/bash/bashrc-includes.d/system_linux_func_reverse_fqdn create mode 100644 files/root/.config/bash/bashrc-includes.d/system_linux_func_slash_fqdn diff --git a/files/root/.config/bash/bashrc-includes.d/system_linux_func_reverse_fqdn b/files/root/.config/bash/bashrc-includes.d/system_linux_func_reverse_fqdn new file mode 100644 index 0000000..ceb6193 --- /dev/null +++ b/files/root/.config/bash/bashrc-includes.d/system_linux_func_reverse_fqdn @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: MIT +function reverse_fqdn() { + python3 -c 'import sys; arg_list = sys.argv[1].split("."); arg_list.reverse(); print(".".join(arg_list))' "${1}" +} diff --git a/files/root/.config/bash/bashrc-includes.d/system_linux_func_slash_fqdn b/files/root/.config/bash/bashrc-includes.d/system_linux_func_slash_fqdn new file mode 100644 index 0000000..33a3c0b --- /dev/null +++ b/files/root/.config/bash/bashrc-includes.d/system_linux_func_slash_fqdn @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: MIT +function slash_fqdn() { + python3 -c 'import sys; arg_list = sys.argv[1].split("."); arg_list.reverse(); print("/".join(arg_list))' "${1}" +}