diff --git a/neofetch b/neofetch index 9b40412d..496af946 100755 --- a/neofetch +++ b/neofetch @@ -1211,13 +1211,13 @@ get_uptime() { # Get uptime in seconds. case "$os" in "Linux" | "Windows" | "MINIX") - if [ -f /proc/uptime ]; then + if [[ -r /proc/uptime ]]; then seconds="$(< /proc/uptime)" seconds="${seconds/.*}" - else # Android >= 9 denies /proc/uptime access - boot=$(date -d"$(uptime -s)" +%s) \ - && now="$(date +%s)" \ - && seconds="$((now - boot))" + else + boot="$(date -d"$(uptime -s)" +%s)" + now="$(date +%s)" + seconds="$((now - boot))" fi ;;