Blame subr.rtl/rtl.subr

Lucio Andrés Illanes Albornoz c6d6e0
#
8d7a8a
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂ­a Andrea Illanes Albornoz <lucia@luciaillanes.de>
Lucio Andrés Illanes Albornoz e1d469
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz c6d6e0
#
Lucio Andrés Illanes Albornoz c6d6e0
e9fa07
# <SPACE><HT><LF>
e9fa07
RTL_IFS_ORIG=" 	
e9fa07
";
e9fa07
e9fa07
# <LF>
e9fa07
RTL_NL="
e9fa07
";
e9fa07
e9fa07
rtl_date() { local _rdate="${1#\$}"; shift; eval ${_rdate}=\"\$\(command date \"+\${1:-\${DEFAULT_TIMESTAMP_FMT:-\"%Y/%m/%d %H:%M:%S\"}}\"\)\"; };
e9fa07
rtl_set_IFS_nl() { IFS="${RTL_NL}"; };
e9fa07
rtl_set_var_unsafe() { [ "${2:+1}" = 1 ] && eval ${1}=\"${2}\" || return 0; };
Lucio Andrés Illanes Albornoz c6d6e0
rtl_test_cmd() { command -v "${1}" >/dev/null; };
Lucio Andrés Illanes Albornoz b6a9a1
rtl_uniq() { if [ "${#}" -gt 0 ]; then printf "%s" "${*}" | sed 's/ /\n/g' | awk '!x[$0]++' | paste -s -d" "; fi; };
e9fa07
rtl_uniq2() { eval set -- \${${1#\$}}; if [ "${#}" -gt 0 ]; then printf "%s" "${*}" | sed 's/ /\n/g' | awk '!x[$0]++' | paste -s -d" "; fi; };
Lucio Andrés Illanes Albornoz c6d6e0
rtl_unset_vars() { while [ ${#} -gt 0 ]; do unset "${1}"; shift; done; };
Lucio Andrés Illanes Albornoz c6d6e0
e9fa07
# vim:filetype=sh textwidth=0