root detection functions

This commit is contained in:
Roger Pàmies Fabra 2023-01-28 22:33:49 +01:00
parent aab99cccc1
commit c1ed52ede0
1 changed files with 18 additions and 0 deletions

View File

@ -26,6 +26,23 @@ show_ssh_hosts () {
fi fi
} }
is_root () {
echo "test root"
echo "$(id -u)"
return $(id -u)
}
remote_update () {
echo $1
ssh $1 << EOF
# date
# hostname
# cat /etc/resolv.conf
$(typeset -f is_root)
is_root
EOF
}
#for i in "${targets[@]}" #for i in "${targets[@]}"
#do #do
# : # :
@ -72,6 +89,7 @@ elif [ "$((HOST-OFFSET_OPTIONS))" -gt 7 ]; then
else else
index=$((HOST-OFFSET_OPTIONS)) index=$((HOST-OFFSET_OPTIONS))
echo "${TARGETS[$index]}" echo "${TARGETS[$index]}"
remote_update "${TARGETS[$index]}"
fi fi
done done