~dr|z3d
@RN
@RN_
@T3s|4
@eyedeekay
@orignal
@postman
@zzz
%Liorar
%acetone
%ardu
%cumlord
%mareki2p
+FreefallHeavens_
+Over
+Sh0ck
+Xeha
+bak83_
+hk
+moe
+profetikla
+qend-irc2p
+r00tobo
+romer
+uop23ip
+xHarr
Arch
BubbRubb
C341
Danny
DeltaOreo
FreeB
Irc2PGuest10122
Irc2PGuest23831
Irc2PGuest34088
Irc2PGuest488
Irc2PGuest58424
Irc2PGuest83998
Meow
anontor
b4dab00m
duck
halloy13412
lazygravy
maylay
nilbog
not_bob_afk
poriori_
pory
r00tobo[2]
shiver_
simprelay
solidx66
thetia
u5657_
waffles
woodwose
zer0bitz
tennis2
I'm having a brain freeze and its Bash again.
tennis2
THankfully this one is a smaller setup than the last
tennis2
I would like to tell the user how many torrent metadata were wiped as well as the exact torrents. I think that number can help ppl quickly identify when all the torrents disappeared.
tennis2
Imagine that instead of "Bing Bang Bong" in the following we instead identified three real torrents as missing...
tennis2
missingCount=0
tennis2
echo -e "Bing bloat\nBong[Glow]\nBang.now" \
tennis2
| while read name ; do \
tennis2
if [ ! "x${name:0:1}" == "x" ];then echo -e "$name"; missingCount=$(($missingCount+1)); fi; \
tennis2
done \
tennis2
| zenity --list $SD_ICON --title="$PROGNAME - Data missing" \
tennis2
--height=450 --column="Missing metadata..." --multiple --separator="\n" \
tennis2
--text="Since the last backup, torrent metadata from $missingCount torrent(s) that helps \npreserve the disk is missing. If you don't remember deleting the torrents \nthen this may be a result of files being unavailable recently.\n\nRestore the metadata that helps preserve your disk?\n" \
tennis2
--ok-label 'DELETE THEM ALL!' \
tennis2
--cancel-label="Restore all..."
tennis2
Blinded message
tennis2
So for some reason $missingCount IS NOT incrementing and I don't know why
tennis2
Can anyone here see it?
tennis2
BTW the name:0:1 is just a substring of the torrent name, the first character in the torrent filename, ie. between 0th and 1st position (for some reason I was getting a few empty strings in the list of torrents
tennis2
Blinded message
tennis2
There is another problem. If someone cancels out of this dialog the default behavior is to restore, I did that on purpose but if someone double clicks a torrent in the list then (0) OK is returned which will mean delete. So I think I'll just switch it back around.
tennis2
Oh and yes, I also tried $((missingCount++));
tennis2
Maybe its a good sign that noone knows how to fix that Bash problem. Maybe it works in a Bash script, just not when dumping it to the terminal
tennis2
That happens
profetikla
tennis2: probably related: stackoverflow.com/questions/42963395/bash-assign-variable-from-pipe
profetikla
The variable does get incremented, but it happens only inside of the "while read name".
not_bob
Why is incognet.i2p broken?
T3s|4
tennis2: why don't you ask on #bash on libera? ~900 nicks present: Topic for #bash is "https://mywiki.wooledge.org/BashFAQ | mywiki.wooledge.org/BashGuide