Wrap echo output in bash shell so sudo works

This commit is contained in:
Quad 2021-05-20 14:32:48 +02:00
parent e5e29d5c8d
commit ba77bdcfa3
1 changed files with 5 additions and 1 deletions

View File

@ -98,7 +98,11 @@ set_pl () {
elif [ $1 -eq 2 ]; then
pl_path=$pl2_path
fi
echo $(w_to_uw $2) > $pl_path
if [ "$EUID" -eq 0 ]; then
echo $(w_to_uw $2) > $pl_path
else
sudo bash -c "echo $(w_to_uw $2) > ${pl_path}"
fi
else
exit 1
fi