From ee376ffaf7bcc3c3a3a717a57936c913cdd4da81 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Sun, 27 Oct 2019 09:12:12 -0600 Subject: [PATCH] add "file name count" function which counts non^# lines --- boxctl.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/boxctl.sh b/boxctl.sh index 789f856..da15b17 100755 --- a/boxctl.sh +++ b/boxctl.sh @@ -210,16 +210,22 @@ _ssh() { V=$(expand_v) +fnc() { + local _count + _count=$(grep -v ^# $1 | wc -l | awk '{print $1}') + echo "${1} ${_count}" +} + if [ -f ./packages ]; then - msg 0 "installing $(wc -l packages | awk '{print $1 " " $2}')" + msg 0 "installing $(fnc packages)" cmd=$(printf "${PKG_DIFF_INSTALL}" $V $V) _scp packages "${RUN_USER}@${SERVER}:/etc/packages.tmp" _ssh ${RUN_USER}@${SERVER} "${cmd}" fi if [ -f ./groups ]; then - msg 0 "adding $(wc -l groups | awk '{print $1 " " $2}')" - for group in $(cat groups); do + msg 0 "adding $(fnc groups)" + for group in $(cat groups | grep -v ^#); do local _group _gid read _group _gid <