Run the sed substitute command on reddit comments.
I am running it with the user /u/_sed_.
"i am a bad person" - /u/sad_redditor | "sed s/bad/good/" - /u/wholesome_redditor || "i am a good person" - /u/_sed_ "sudo apt-get install gentoo" - /u/linux_redditor | "sed s/-get//" - /u/snarky_redditor || "sudo apt install gentoo" - /u/_sed_ "my hovercraft is full of eels" - /u/casual_redditor | "sed s/[aeiouy]/o/g s/$/!/" - /u/cheeky_redditor || "mo hovorcroft os foll of ools!" - /u/_sed_
See more sed examples at http://www.grymoire.com/Unix/Sed.html
What it does
- Matches reddit comments that start with
sedand include the pattern
- Runs the command
echo "parent comment" | sed "s/pattern/replacement/flag"using subprocess.Popen
- Replies with the output of the command
Is it safe to let reddit run commands in your terminal?
True, then no, absolutely not.
But since the bot doesn't have
shell = True, the command
echo "hello`rm -rf ~/*\`world"
hello`rm -rf ~/*`world
and it's all good. I hope.
Don't try this command in your terminal!