Blob Blame History Raw
#
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂ­a Andrea Illanes Albornoz <lucia@luciaillanes.de>
# set +o errexit -o noglob -o nounset is assumed.
#

# <SPACE><HT><LF>
RTL_IFS_ORIG=" 	
";

# <LF>
RTL_NL="
";

rtl_date() { local _rdate="${1#\$}"; shift; eval ${_rdate}=\"\$\(command date \"+\${1:-\${DEFAULT_TIMESTAMP_FMT:-\"%Y/%m/%d %H:%M:%S\"}}\"\)\"; };
rtl_set_IFS_nl() { IFS="${RTL_NL}"; };
rtl_test_cmd() { command -v "${1}" >/dev/null; };
rtl_uniq() { if [ "${#}" -gt 0 ]; then printf "%s" "${*}" | sed 's/ /\n/g' | awk '!x[$0]++' | paste -s -d" "; fi; };
rtl_uniq2() { eval set -- \${${1#\$}}; if [ "${#}" -gt 0 ]; then printf "%s" "${*}" | sed 's/ /\n/g' | awk '!x[$0]++' | paste -s -d" "; fi; };
rtl_unset_vars() { while [ ${#} -gt 0 ]; do unset "${1}"; shift; done; };

# vim:filetype=sh textwidth=0