table

Помоћни програм из командне линије за форматирање и приказ CSV-а
git clone https://git.sr.ht/~strahinja/table
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување a63a6893335bd9040400b4526227ae59ffdd866f
родитељ 8b25384116d7e4667b7a07bc80639bc2a2b02ef8
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Tue, 17 Mar 2026 19:18:23 +0100

lib/make{date,version}: Synchronize build scripts with poe

Diffstat:
Mlib/makedate | 12+++++++-----
Mlib/makeversion | 12+++++++-----
измењених датотека: 2, додавања: 14(+), брисања: 10(-)

diff --git a/lib/makedate b/lib/makedate @@ -17,16 +17,17 @@ exists() getent() { + geresult='' if exists getent; then - command getent "$@" + geresult=$(command getent "$@" 2>/dev/null) return fi case "$1" in passwd|group) if [ -z "$2" ]; then - cat /etc/"$1" + geresult=$(cat /etc/"$1") else - awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1" + geresult=$(awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1") fi ;; *) ;; @@ -57,8 +58,9 @@ if [ -d .got ] && exists got; then exit }' >date.new elif [ -d .git ] && exists git; then - user=$(getent passwd "$(unalias ls >/dev/null 2>&1 || true; \ - command ls -nd . | awk '{print $3}')" | awk -F: '{print $1}') + getent passwd "$(unalias ls >/dev/null 2>&1 || true; \ + command ls -nd . | awk '{print $3}')" + user=$(printf "%s\n" "$geresult" | awk -F: '{print $1}') if [ -z "$user" ]; then printf "$0: error: Cannot determine owner of %s" "$(pwd)" >&2 exit 1 diff --git a/lib/makeversion b/lib/makeversion @@ -17,16 +17,17 @@ exists() getent() { + geresult='' if exists getent; then - command getent "$@" + geresult=$(command getent "$@" 2>/dev/null) return fi case "$1" in passwd|group) if [ -z "$2" ]; then - cat /etc/"$1" + geresult=$(cat /etc/"$1") else - awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1" + geresult=$(awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1") fi ;; *) ;; @@ -64,8 +65,9 @@ if [ -d .got ] && exists got; then printf "\n" }' >version.new elif [ -d .git ] && exists git; then - user=$(getent passwd "$(unalias ls >/dev/null 2>&1 || true; \ - command ls -nd . | awk '{print $3}')" | awk -F: '{print $1}') + getent passwd "$(unalias ls >/dev/null 2>&1 || true; \ + command ls -nd . | awk '{print $3}')" + user=$(printf "%s\n" "$geresult" | awk -F: '{print $1}') if [ -z "$user" ]; then printf "$0: error: Cannot determine owner of %s" "$(pwd)" >&2 exit 1