Total Progress over entire bash shell script
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
EDIT FOR CLARITY :
say I have the following script (let's posit pv and curl are already installed) :
(that currently runs under ubuntu but that I plan to make POSIX-compliant so that it may run on more linux ditributions)
#!/bin/bash
sudo apt install vlc
mkdir -p ~/.steam/compatibilitytools.d
PROTONVERSIONNUMBER=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "tag_name" | head -n 1 | cut -f4,4 -d""")
REPLACING=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "target_commitish" | head -n 1 | cut -f4,4 -d""" | sed "s/[^_]+/Lu&/g")
PROTONVERSION=$REPLACING/_G/-6_G
PROTONNAME=$PROTONVERSION"_"$PROTONVERSIONNUMBER##*-
wget https://github.com/popsUlfr/Proton/releases/download/$PROTONVERSIONNUMBER/$PROTONNAME.tar.xz
pv $PROTONNAME.tar.xz | tar xp -J -C ~/.steam/compatibilitytools.d
rm $PROTONNAME.tar.xz
I get three progress bars, these progress bars seem very beautiful to me :
the way they're accurate and stuff, I dunno call me a weirdo
QUESTION
How do I utilize the power of these three seperate progress bars to form one continuous progress bar that respects currents progress bar "speeds" of the underlying "true" progress bars?
bash shell-script shell pv whiptail
add a comment |
EDIT FOR CLARITY :
say I have the following script (let's posit pv and curl are already installed) :
(that currently runs under ubuntu but that I plan to make POSIX-compliant so that it may run on more linux ditributions)
#!/bin/bash
sudo apt install vlc
mkdir -p ~/.steam/compatibilitytools.d
PROTONVERSIONNUMBER=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "tag_name" | head -n 1 | cut -f4,4 -d""")
REPLACING=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "target_commitish" | head -n 1 | cut -f4,4 -d""" | sed "s/[^_]+/Lu&/g")
PROTONVERSION=$REPLACING/_G/-6_G
PROTONNAME=$PROTONVERSION"_"$PROTONVERSIONNUMBER##*-
wget https://github.com/popsUlfr/Proton/releases/download/$PROTONVERSIONNUMBER/$PROTONNAME.tar.xz
pv $PROTONNAME.tar.xz | tar xp -J -C ~/.steam/compatibilitytools.d
rm $PROTONNAME.tar.xz
I get three progress bars, these progress bars seem very beautiful to me :
the way they're accurate and stuff, I dunno call me a weirdo
QUESTION
How do I utilize the power of these three seperate progress bars to form one continuous progress bar that respects currents progress bar "speeds" of the underlying "true" progress bars?
bash shell-script shell pv whiptail
You mention some concerns about the availability ofpv
, but do not seem to have the same concerns regarding the availability ofwhiptail
,apt
,bash
,sudo
, orwget
. Do you have portability constraints at all? What does your "every OS" mean?
– Kusalananda♦
Mar 8 at 10:38
well ok my script is actually more robust then the barebones example above, I actually have a huge if else going over almost all possible linux distros and later down case switches change for examplesudo
andapt
to their equivalents. maybe I should edit my post to specify that I intend for it to work on all distros but start by getting it to work on ubuntu first, for whichwhiptail
andwget
comes prepakaged butpv
not. That being said I haven't entirely excluded working with pv, it seems quite powerfull and might be worth a temporary install as part of the script.
– tatsu
Mar 8 at 10:44
add a comment |
EDIT FOR CLARITY :
say I have the following script (let's posit pv and curl are already installed) :
(that currently runs under ubuntu but that I plan to make POSIX-compliant so that it may run on more linux ditributions)
#!/bin/bash
sudo apt install vlc
mkdir -p ~/.steam/compatibilitytools.d
PROTONVERSIONNUMBER=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "tag_name" | head -n 1 | cut -f4,4 -d""")
REPLACING=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "target_commitish" | head -n 1 | cut -f4,4 -d""" | sed "s/[^_]+/Lu&/g")
PROTONVERSION=$REPLACING/_G/-6_G
PROTONNAME=$PROTONVERSION"_"$PROTONVERSIONNUMBER##*-
wget https://github.com/popsUlfr/Proton/releases/download/$PROTONVERSIONNUMBER/$PROTONNAME.tar.xz
pv $PROTONNAME.tar.xz | tar xp -J -C ~/.steam/compatibilitytools.d
rm $PROTONNAME.tar.xz
I get three progress bars, these progress bars seem very beautiful to me :
the way they're accurate and stuff, I dunno call me a weirdo
QUESTION
How do I utilize the power of these three seperate progress bars to form one continuous progress bar that respects currents progress bar "speeds" of the underlying "true" progress bars?
bash shell-script shell pv whiptail
EDIT FOR CLARITY :
say I have the following script (let's posit pv and curl are already installed) :
(that currently runs under ubuntu but that I plan to make POSIX-compliant so that it may run on more linux ditributions)
#!/bin/bash
sudo apt install vlc
mkdir -p ~/.steam/compatibilitytools.d
PROTONVERSIONNUMBER=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "tag_name" | head -n 1 | cut -f4,4 -d""")
REPLACING=$(curl -v --silent https://api.github.com/repos/popsUlfr/Proton/releases 2>&1 | grep "target_commitish" | head -n 1 | cut -f4,4 -d""" | sed "s/[^_]+/Lu&/g")
PROTONVERSION=$REPLACING/_G/-6_G
PROTONNAME=$PROTONVERSION"_"$PROTONVERSIONNUMBER##*-
wget https://github.com/popsUlfr/Proton/releases/download/$PROTONVERSIONNUMBER/$PROTONNAME.tar.xz
pv $PROTONNAME.tar.xz | tar xp -J -C ~/.steam/compatibilitytools.d
rm $PROTONNAME.tar.xz
I get three progress bars, these progress bars seem very beautiful to me :
the way they're accurate and stuff, I dunno call me a weirdo
QUESTION
How do I utilize the power of these three seperate progress bars to form one continuous progress bar that respects currents progress bar "speeds" of the underlying "true" progress bars?
bash shell-script shell pv whiptail
bash shell-script shell pv whiptail
edited Mar 8 at 14:14
tatsu
asked Mar 8 at 10:33
tatsutatsu
1187
1187
You mention some concerns about the availability ofpv
, but do not seem to have the same concerns regarding the availability ofwhiptail
,apt
,bash
,sudo
, orwget
. Do you have portability constraints at all? What does your "every OS" mean?
– Kusalananda♦
Mar 8 at 10:38
well ok my script is actually more robust then the barebones example above, I actually have a huge if else going over almost all possible linux distros and later down case switches change for examplesudo
andapt
to their equivalents. maybe I should edit my post to specify that I intend for it to work on all distros but start by getting it to work on ubuntu first, for whichwhiptail
andwget
comes prepakaged butpv
not. That being said I haven't entirely excluded working with pv, it seems quite powerfull and might be worth a temporary install as part of the script.
– tatsu
Mar 8 at 10:44
add a comment |
You mention some concerns about the availability ofpv
, but do not seem to have the same concerns regarding the availability ofwhiptail
,apt
,bash
,sudo
, orwget
. Do you have portability constraints at all? What does your "every OS" mean?
– Kusalananda♦
Mar 8 at 10:38
well ok my script is actually more robust then the barebones example above, I actually have a huge if else going over almost all possible linux distros and later down case switches change for examplesudo
andapt
to their equivalents. maybe I should edit my post to specify that I intend for it to work on all distros but start by getting it to work on ubuntu first, for whichwhiptail
andwget
comes prepakaged butpv
not. That being said I haven't entirely excluded working with pv, it seems quite powerfull and might be worth a temporary install as part of the script.
– tatsu
Mar 8 at 10:44
You mention some concerns about the availability of
pv
, but do not seem to have the same concerns regarding the availability of whiptail
, apt
, bash
, sudo
, or wget
. Do you have portability constraints at all? What does your "every OS" mean?– Kusalananda♦
Mar 8 at 10:38
You mention some concerns about the availability of
pv
, but do not seem to have the same concerns regarding the availability of whiptail
, apt
, bash
, sudo
, or wget
. Do you have portability constraints at all? What does your "every OS" mean?– Kusalananda♦
Mar 8 at 10:38
well ok my script is actually more robust then the barebones example above, I actually have a huge if else going over almost all possible linux distros and later down case switches change for example
sudo
and apt
to their equivalents. maybe I should edit my post to specify that I intend for it to work on all distros but start by getting it to work on ubuntu first, for which whiptail
and wget
comes prepakaged but pv
not. That being said I haven't entirely excluded working with pv, it seems quite powerfull and might be worth a temporary install as part of the script.– tatsu
Mar 8 at 10:44
well ok my script is actually more robust then the barebones example above, I actually have a huge if else going over almost all possible linux distros and later down case switches change for example
sudo
and apt
to their equivalents. maybe I should edit my post to specify that I intend for it to work on all distros but start by getting it to work on ubuntu first, for which whiptail
and wget
comes prepakaged but pv
not. That being said I haven't entirely excluded working with pv, it seems quite powerfull and might be worth a temporary install as part of the script.– tatsu
Mar 8 at 10:44
add a comment |
1 Answer
1
active
oldest
votes
Here is a sample piece of code that demonstrates how you can have multiple sections of "work" all updating the same progress meter. The Whiptail gauge is attached to the script's file descriptor 3, so that it can be updated at any point during the script. (The gauge exits automatically when the script ends, or when FD 3 is explicitly closed.)
#!/bin/bash
#
pid=
tmpd=
tidyUp()
# Clean up when we're done
exec 3>&-
[[ -n "$tmpd" ]] && rm -rf "$tmpd"
trap 'ss=$?; tidyUp; exit $ss' 1 2 15
updateGauge()
local percent="$1" message="$2"
printf "XXXn%dn%snXXXn" $percent "$message" >&3
# Create the FIFO for communicating with the whiptail gauge
tmpd=$(mktemp --tmpdir --directory "wt.XXXXXXXXXX")
mkfifo "$tmpd/fifo"
# Start up the whiptail gauge and associate FD 3 with its status
whiptail --title 'Progress meter' --gauge 'Starting examples' 6 50 0 <"$tmpd/fifo" &
exec 3>"$tmpd/fifo"
# Real code starts here
percent=0
for example in 1 2 3
do
updateGauge $percent "Getting example $example"
sleep 3 # wget something
percent=$((percent + 20))
done
for another in 4 5
do
updateGauge $percent "Doing work for another example $another"
sleep 2 # do some work
percent=$((percent + 20))
done
# Done
tidyUp
exit 0
that's a no, there are two problems with this, one, the bar doesn't move between steps, the point of my question was "how could I benefit from existing progress bars?" not "how could I disregard them?" the second issue is that while you do get to see wget's progress bar on top, the display is broken : imgur.com/Q7Wod9N and either way I'm sure whiptail's intended behavior is to only have whiptail visible. I think i'll try with pv instead.
– tatsu
Mar 8 at 12:40
1. As written it does move between steps. If it doesn't work for you, how are you calling it?
– roaima
Mar 8 at 12:47
1
2. You'd runwget -q
so that the whiptail progress meter was the only thing showing. I addressed your seemingly fundamental "all I want is to have a progress bar present from start to finish of my script". Pretty definite to me.
– roaima
Mar 8 at 12:49
I dunno you try it : pastebin.com/2YZRgu4B I get visual glitching all over the terminal console, it's impossible to see what's going on.
– tatsu
Mar 8 at 12:57
here's a new version where I fixed the extra outputs : pastebin.com/ikrp7AN2 as you can see, the progress bar of whiptail jumps from 0 to 20 ect... i can see why if I remove pv from the tar opperation whiptail would have nothing to go off of but for the wget it has no progress either
– tatsu
Mar 8 at 13:05
|
show 8 more comments
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f505103%2ftotal-progress-over-entire-bash-shell-script%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a sample piece of code that demonstrates how you can have multiple sections of "work" all updating the same progress meter. The Whiptail gauge is attached to the script's file descriptor 3, so that it can be updated at any point during the script. (The gauge exits automatically when the script ends, or when FD 3 is explicitly closed.)
#!/bin/bash
#
pid=
tmpd=
tidyUp()
# Clean up when we're done
exec 3>&-
[[ -n "$tmpd" ]] && rm -rf "$tmpd"
trap 'ss=$?; tidyUp; exit $ss' 1 2 15
updateGauge()
local percent="$1" message="$2"
printf "XXXn%dn%snXXXn" $percent "$message" >&3
# Create the FIFO for communicating with the whiptail gauge
tmpd=$(mktemp --tmpdir --directory "wt.XXXXXXXXXX")
mkfifo "$tmpd/fifo"
# Start up the whiptail gauge and associate FD 3 with its status
whiptail --title 'Progress meter' --gauge 'Starting examples' 6 50 0 <"$tmpd/fifo" &
exec 3>"$tmpd/fifo"
# Real code starts here
percent=0
for example in 1 2 3
do
updateGauge $percent "Getting example $example"
sleep 3 # wget something
percent=$((percent + 20))
done
for another in 4 5
do
updateGauge $percent "Doing work for another example $another"
sleep 2 # do some work
percent=$((percent + 20))
done
# Done
tidyUp
exit 0
that's a no, there are two problems with this, one, the bar doesn't move between steps, the point of my question was "how could I benefit from existing progress bars?" not "how could I disregard them?" the second issue is that while you do get to see wget's progress bar on top, the display is broken : imgur.com/Q7Wod9N and either way I'm sure whiptail's intended behavior is to only have whiptail visible. I think i'll try with pv instead.
– tatsu
Mar 8 at 12:40
1. As written it does move between steps. If it doesn't work for you, how are you calling it?
– roaima
Mar 8 at 12:47
1
2. You'd runwget -q
so that the whiptail progress meter was the only thing showing. I addressed your seemingly fundamental "all I want is to have a progress bar present from start to finish of my script". Pretty definite to me.
– roaima
Mar 8 at 12:49
I dunno you try it : pastebin.com/2YZRgu4B I get visual glitching all over the terminal console, it's impossible to see what's going on.
– tatsu
Mar 8 at 12:57
here's a new version where I fixed the extra outputs : pastebin.com/ikrp7AN2 as you can see, the progress bar of whiptail jumps from 0 to 20 ect... i can see why if I remove pv from the tar opperation whiptail would have nothing to go off of but for the wget it has no progress either
– tatsu
Mar 8 at 13:05
|
show 8 more comments
Here is a sample piece of code that demonstrates how you can have multiple sections of "work" all updating the same progress meter. The Whiptail gauge is attached to the script's file descriptor 3, so that it can be updated at any point during the script. (The gauge exits automatically when the script ends, or when FD 3 is explicitly closed.)
#!/bin/bash
#
pid=
tmpd=
tidyUp()
# Clean up when we're done
exec 3>&-
[[ -n "$tmpd" ]] && rm -rf "$tmpd"
trap 'ss=$?; tidyUp; exit $ss' 1 2 15
updateGauge()
local percent="$1" message="$2"
printf "XXXn%dn%snXXXn" $percent "$message" >&3
# Create the FIFO for communicating with the whiptail gauge
tmpd=$(mktemp --tmpdir --directory "wt.XXXXXXXXXX")
mkfifo "$tmpd/fifo"
# Start up the whiptail gauge and associate FD 3 with its status
whiptail --title 'Progress meter' --gauge 'Starting examples' 6 50 0 <"$tmpd/fifo" &
exec 3>"$tmpd/fifo"
# Real code starts here
percent=0
for example in 1 2 3
do
updateGauge $percent "Getting example $example"
sleep 3 # wget something
percent=$((percent + 20))
done
for another in 4 5
do
updateGauge $percent "Doing work for another example $another"
sleep 2 # do some work
percent=$((percent + 20))
done
# Done
tidyUp
exit 0
that's a no, there are two problems with this, one, the bar doesn't move between steps, the point of my question was "how could I benefit from existing progress bars?" not "how could I disregard them?" the second issue is that while you do get to see wget's progress bar on top, the display is broken : imgur.com/Q7Wod9N and either way I'm sure whiptail's intended behavior is to only have whiptail visible. I think i'll try with pv instead.
– tatsu
Mar 8 at 12:40
1. As written it does move between steps. If it doesn't work for you, how are you calling it?
– roaima
Mar 8 at 12:47
1
2. You'd runwget -q
so that the whiptail progress meter was the only thing showing. I addressed your seemingly fundamental "all I want is to have a progress bar present from start to finish of my script". Pretty definite to me.
– roaima
Mar 8 at 12:49
I dunno you try it : pastebin.com/2YZRgu4B I get visual glitching all over the terminal console, it's impossible to see what's going on.
– tatsu
Mar 8 at 12:57
here's a new version where I fixed the extra outputs : pastebin.com/ikrp7AN2 as you can see, the progress bar of whiptail jumps from 0 to 20 ect... i can see why if I remove pv from the tar opperation whiptail would have nothing to go off of but for the wget it has no progress either
– tatsu
Mar 8 at 13:05
|
show 8 more comments
Here is a sample piece of code that demonstrates how you can have multiple sections of "work" all updating the same progress meter. The Whiptail gauge is attached to the script's file descriptor 3, so that it can be updated at any point during the script. (The gauge exits automatically when the script ends, or when FD 3 is explicitly closed.)
#!/bin/bash
#
pid=
tmpd=
tidyUp()
# Clean up when we're done
exec 3>&-
[[ -n "$tmpd" ]] && rm -rf "$tmpd"
trap 'ss=$?; tidyUp; exit $ss' 1 2 15
updateGauge()
local percent="$1" message="$2"
printf "XXXn%dn%snXXXn" $percent "$message" >&3
# Create the FIFO for communicating with the whiptail gauge
tmpd=$(mktemp --tmpdir --directory "wt.XXXXXXXXXX")
mkfifo "$tmpd/fifo"
# Start up the whiptail gauge and associate FD 3 with its status
whiptail --title 'Progress meter' --gauge 'Starting examples' 6 50 0 <"$tmpd/fifo" &
exec 3>"$tmpd/fifo"
# Real code starts here
percent=0
for example in 1 2 3
do
updateGauge $percent "Getting example $example"
sleep 3 # wget something
percent=$((percent + 20))
done
for another in 4 5
do
updateGauge $percent "Doing work for another example $another"
sleep 2 # do some work
percent=$((percent + 20))
done
# Done
tidyUp
exit 0
Here is a sample piece of code that demonstrates how you can have multiple sections of "work" all updating the same progress meter. The Whiptail gauge is attached to the script's file descriptor 3, so that it can be updated at any point during the script. (The gauge exits automatically when the script ends, or when FD 3 is explicitly closed.)
#!/bin/bash
#
pid=
tmpd=
tidyUp()
# Clean up when we're done
exec 3>&-
[[ -n "$tmpd" ]] && rm -rf "$tmpd"
trap 'ss=$?; tidyUp; exit $ss' 1 2 15
updateGauge()
local percent="$1" message="$2"
printf "XXXn%dn%snXXXn" $percent "$message" >&3
# Create the FIFO for communicating with the whiptail gauge
tmpd=$(mktemp --tmpdir --directory "wt.XXXXXXXXXX")
mkfifo "$tmpd/fifo"
# Start up the whiptail gauge and associate FD 3 with its status
whiptail --title 'Progress meter' --gauge 'Starting examples' 6 50 0 <"$tmpd/fifo" &
exec 3>"$tmpd/fifo"
# Real code starts here
percent=0
for example in 1 2 3
do
updateGauge $percent "Getting example $example"
sleep 3 # wget something
percent=$((percent + 20))
done
for another in 4 5
do
updateGauge $percent "Doing work for another example $another"
sleep 2 # do some work
percent=$((percent + 20))
done
# Done
tidyUp
exit 0
answered Mar 8 at 12:01
roaimaroaima
46k758124
46k758124
that's a no, there are two problems with this, one, the bar doesn't move between steps, the point of my question was "how could I benefit from existing progress bars?" not "how could I disregard them?" the second issue is that while you do get to see wget's progress bar on top, the display is broken : imgur.com/Q7Wod9N and either way I'm sure whiptail's intended behavior is to only have whiptail visible. I think i'll try with pv instead.
– tatsu
Mar 8 at 12:40
1. As written it does move between steps. If it doesn't work for you, how are you calling it?
– roaima
Mar 8 at 12:47
1
2. You'd runwget -q
so that the whiptail progress meter was the only thing showing. I addressed your seemingly fundamental "all I want is to have a progress bar present from start to finish of my script". Pretty definite to me.
– roaima
Mar 8 at 12:49
I dunno you try it : pastebin.com/2YZRgu4B I get visual glitching all over the terminal console, it's impossible to see what's going on.
– tatsu
Mar 8 at 12:57
here's a new version where I fixed the extra outputs : pastebin.com/ikrp7AN2 as you can see, the progress bar of whiptail jumps from 0 to 20 ect... i can see why if I remove pv from the tar opperation whiptail would have nothing to go off of but for the wget it has no progress either
– tatsu
Mar 8 at 13:05
|
show 8 more comments
that's a no, there are two problems with this, one, the bar doesn't move between steps, the point of my question was "how could I benefit from existing progress bars?" not "how could I disregard them?" the second issue is that while you do get to see wget's progress bar on top, the display is broken : imgur.com/Q7Wod9N and either way I'm sure whiptail's intended behavior is to only have whiptail visible. I think i'll try with pv instead.
– tatsu
Mar 8 at 12:40
1. As written it does move between steps. If it doesn't work for you, how are you calling it?
– roaima
Mar 8 at 12:47
1
2. You'd runwget -q
so that the whiptail progress meter was the only thing showing. I addressed your seemingly fundamental "all I want is to have a progress bar present from start to finish of my script". Pretty definite to me.
– roaima
Mar 8 at 12:49
I dunno you try it : pastebin.com/2YZRgu4B I get visual glitching all over the terminal console, it's impossible to see what's going on.
– tatsu
Mar 8 at 12:57
here's a new version where I fixed the extra outputs : pastebin.com/ikrp7AN2 as you can see, the progress bar of whiptail jumps from 0 to 20 ect... i can see why if I remove pv from the tar opperation whiptail would have nothing to go off of but for the wget it has no progress either
– tatsu
Mar 8 at 13:05
that's a no, there are two problems with this, one, the bar doesn't move between steps, the point of my question was "how could I benefit from existing progress bars?" not "how could I disregard them?" the second issue is that while you do get to see wget's progress bar on top, the display is broken : imgur.com/Q7Wod9N and either way I'm sure whiptail's intended behavior is to only have whiptail visible. I think i'll try with pv instead.
– tatsu
Mar 8 at 12:40
that's a no, there are two problems with this, one, the bar doesn't move between steps, the point of my question was "how could I benefit from existing progress bars?" not "how could I disregard them?" the second issue is that while you do get to see wget's progress bar on top, the display is broken : imgur.com/Q7Wod9N and either way I'm sure whiptail's intended behavior is to only have whiptail visible. I think i'll try with pv instead.
– tatsu
Mar 8 at 12:40
1. As written it does move between steps. If it doesn't work for you, how are you calling it?
– roaima
Mar 8 at 12:47
1. As written it does move between steps. If it doesn't work for you, how are you calling it?
– roaima
Mar 8 at 12:47
1
1
2. You'd run
wget -q
so that the whiptail progress meter was the only thing showing. I addressed your seemingly fundamental "all I want is to have a progress bar present from start to finish of my script". Pretty definite to me.– roaima
Mar 8 at 12:49
2. You'd run
wget -q
so that the whiptail progress meter was the only thing showing. I addressed your seemingly fundamental "all I want is to have a progress bar present from start to finish of my script". Pretty definite to me.– roaima
Mar 8 at 12:49
I dunno you try it : pastebin.com/2YZRgu4B I get visual glitching all over the terminal console, it's impossible to see what's going on.
– tatsu
Mar 8 at 12:57
I dunno you try it : pastebin.com/2YZRgu4B I get visual glitching all over the terminal console, it's impossible to see what's going on.
– tatsu
Mar 8 at 12:57
here's a new version where I fixed the extra outputs : pastebin.com/ikrp7AN2 as you can see, the progress bar of whiptail jumps from 0 to 20 ect... i can see why if I remove pv from the tar opperation whiptail would have nothing to go off of but for the wget it has no progress either
– tatsu
Mar 8 at 13:05
here's a new version where I fixed the extra outputs : pastebin.com/ikrp7AN2 as you can see, the progress bar of whiptail jumps from 0 to 20 ect... i can see why if I remove pv from the tar opperation whiptail would have nothing to go off of but for the wget it has no progress either
– tatsu
Mar 8 at 13:05
|
show 8 more comments
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f505103%2ftotal-progress-over-entire-bash-shell-script%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You mention some concerns about the availability of
pv
, but do not seem to have the same concerns regarding the availability ofwhiptail
,apt
,bash
,sudo
, orwget
. Do you have portability constraints at all? What does your "every OS" mean?– Kusalananda♦
Mar 8 at 10:38
well ok my script is actually more robust then the barebones example above, I actually have a huge if else going over almost all possible linux distros and later down case switches change for example
sudo
andapt
to their equivalents. maybe I should edit my post to specify that I intend for it to work on all distros but start by getting it to work on ubuntu first, for whichwhiptail
andwget
comes prepakaged butpv
not. That being said I haven't entirely excluded working with pv, it seems quite powerfull and might be worth a temporary install as part of the script.– tatsu
Mar 8 at 10:44