~dr|z3d
@RN
@RN_
@StormyCloud
@T3s|4_
@eyedeekay
@orignal
@postman
@zzz
%Liorar
+FreefallHeavens
+Leopold
+Xeha
+acetone
+bak83_
+cancername
+cumlord
+hk
+profetikla
+uop23ip
+weko
An0nm0n
Arch
Danny
DeltaOreo
DrSekra
Irc2PGuest28769
Irc2PGuest3160
Irc2PGuest63086
Irc2PGuest71439
Meow
Nausicaa
Onn4l7h
Onn4|7h
Over1
anon
anu3
boonst
carried6590
chatrouge
enoxa
mareki2pb
plap
poriori_
shiver_
simprelay
solidx66
tr
u5657
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