Tealk, German
@Tealk@rollenspiel.social avatar

I noticed a problem in my script, if the newest account that was notified is a SpamBot and I delete it, countless old accounts are notified again.

Any ideas on how to solve this problem?

https://codeberg.org/RollenspielMonster/simple-toot

#bash #linux #programming

mforester,
@mforester@rollenspiel.social avatar

@Tealk I assume it's due to line 198, where you check if you've hit the last know username.
If you delete the last user, the script will continue iterating over all usernames without a break condition.
How about keeping a longer list of users and quitting once you hit any known user?
I think contains is not as simple to solve in Bash as with Python, but if you dump everything into a file and grep it?
If you're worried about disk space, you can head -n 100 the user list at the end.

Tealk,
@Tealk@rollenspiel.social avatar
mforester,
@mforester@rollenspiel.social avatar

@Tealk nice. I just took a quick look, but that looks promising. 🙂
I also learned a thing or two about bash, that I didn't know yet.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Bash
  • DreamBathrooms
  • magazineikmin
  • ethstaker
  • InstantRegret
  • cisconetworking
  • rosin
  • love
  • Youngstown
  • slotface
  • ngwrru68w68
  • kavyap
  • tacticalgear
  • thenastyranch
  • mdbf
  • anitta
  • tester
  • modclub
  • normalnudes
  • khanakhh
  • everett
  • GTA5RPClips
  • osvaldo12
  • Leos
  • provamag3
  • Durango
  • cubers
  • megavids
  • JUstTest
  • All magazines