aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpt-lib.in9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 73e483c..5e5e7b4 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -45,6 +45,15 @@ trap_set() {
esac
}
+_seq() (
+ # Pure shell counter meant to be used in 'for' loops.
+ i=0 buf=''
+ while [ "$(( i += 1 ))" -le "$1" ]; do
+ buf="$buf $i "
+ done
+ printf '%s' "$buf"
+)
+
_stat() (
_user=; eval set -- "$(ls -ld "$1")"
id -u "${_user:=$3}" >/dev/null 2>&1 || _user=root