@RN_
@T3s|4_
@orignal
@postman
%acetone
+NiceBoat
+Onn4l7h
+Over
+altec
+nyaa2pguy
+poriori
+profetikla
+qend-irc2p
+r00tobo
+uop23ip
+waffles
Arch
FreefallHeavens
Gully
Irc2PGuest16019
Irc2PGuest20377
Irc2PGuest33925
Irc2PGuest77921
Liorar
MatrixBot
Onn4|7h
StormyCloud
T3s|4
Teeed
WaAmH
ahiru
anontor2
cims
floatyfloatilla
mahlay
makoto
mareki2p_
n2_
nZDoYBkF
nilbog
not_bob_afk2
o3d3
r00tobo[2]
rednode
solidx66
stormycloud[m]
vivid_reader56
zzz
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