Added sudo/doas in the script Logs

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2021-11-09 06:46:12 +01:00
parent 86c45b6bfd
commit 0967ec1a8e
Signed by: y0rune
GPG Key ID: F204C385F57EB348
1 changed files with 10 additions and 2 deletions

View File

@ -1,11 +1,19 @@
#!/bin/bash
NUMBER="-1"
if command -v sudo; then
sudo=$(which sudo)
elif command -v doas; then
sudo=$(which doas)
else
echo "Do you have installed sudo or doas on your system??"
fi
while true
do
clear
LOGS=( $(sudo find /var/tmp/portage/ -mindepth 1 -maxdepth 5 -name "build.log") $(sudo find /var/tmpnotmpfs/portage/ -mindepth 1 -maxdepth 5 -name "build.log") )
LOGS=( $(${sudo} find /var/tmp/portage/ -mindepth 1 -maxdepth 5 -name "build.log") $(${sudo} find /var/tmpnotmpfs/portage/ -mindepth 1 -maxdepth 5 -name "build.log") )
LEN=${#LOGS[@]}
for (( i=0; i<$LEN; i++ ));
@ -20,4 +28,4 @@ do
done
echo -e "\n\e[93m File: ${LOGS[$NUMBER-1]} \e[0m\n"
sudo tail -f ${LOGS[$NUMBER-1]}
${sudo} tail -f "${LOGS[$NUMBER-1]}"