Тёмный

Simple bash script that creates a countdown progress bar 

The Lazy SysAdmin
Подписаться 4,1 тыс.
Просмотров 165
50% 1

There is nothing to see here. I'm just uploading 2024 data so that the internet will not crash.
Just in case you are curious of the script, here it is!!!
#!/bin/bash
countdown() {
local start_timestamp=$1
local end_timestamp=$2
local update_interval=$3
local current_timestamp=$(date +%s)
local remaining=$(($end_timestamp - $current_timestamp))
local total_duration=$(($end_timestamp - $start_timestamp))
local progress=0
while [ $remaining -gt 0 ]; do
current_time=$(date +"%Y-%m-%d %H:%M:%S")
sleep $update_interval
current_timestamp=$(date +%s)
remaining=$(($end_timestamp - $current_timestamp))
Calculate progress as a percentage
progress=$((100 - remaining * 100 / total_duration))
Draw progress bar with text message
printf "[%s] Uploading 2024 Data to the Internet: [%-50s] %d%%
" "$current_time" $(printf "#%.0s" $(seq 1 $((progress / 2)))) $progress
done
printf "
"
}
Set the start and end timestamps
start_timestamp=$(date -d "Dec 31 2023 00:00:00" +%s)
end_timestamp=$(date -d "Jan 01 2024 00:00:00" +%s)
Set the update interval
update_interval=1 # update interval in seconds
Start the countdown
countdown $start_timestamp $end_timestamp $update_interval
echo "Upload complete! Happy New Year 2024!"

Опубликовано:

 

30 дек 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1   
@lazysysad
@lazysysad 6 месяцев назад
Happy new year everyone!!! 🎆🎆🎆
Далее
This Is The World's Fastest Internet #Shorts
0:56
Просмотров 10 млн
شربت كل الماء؟ 🤣
00:31
Просмотров 16 млн
How to Share and Edit Files on Google Drive
12:33
Просмотров 165 тыс.