You are not logged in.

#3201 2018-10-03 13:58:49

Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 2,379

Re: Post your handy self made command line utilities

Trilby wrote:

Eschwartz, to be fair, they didn't sed pacman.conf themselves.  They read pacman.conf line by line in a clumsy and pointless loop and sed''ed part of each line for no reason only to check whether it matched 'IgnorePkg' and then only to oddly and conditionally append a space then a value to a simple variable when an array would be much easier needing no conditional or spaces.

And this is you being "fair"... tongue

Honest, yes, I will grant you that. But generally the phrase "to be fair" is used by people extending mercy, not additional objections. big_smile

If pacman-conf were not an option, that entire loop could just be:

IGNORE=$(sed -n 's/^IgnorePkg[^=]*=//p' /etc/pacman.conf)
# or better as an array
IGNORE=($(sed -n 's/^IgnorePkg[^=]*=//p' /etc/pacman.conf))

If it comes to that, matching on 'IgnorePkg222 = nope' and finding that the "nope" package should be ignored, is rather erroneous...

Don't match:


Do match:


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)


#3202 2018-10-03 14:01:01

Inspector Parrot
Registered: 2011-11-29
Posts: 20,142

Re: Post your handy self made command line utilities

Good revision to my sed command.  To be fair, I'm an idiot. tongue

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman


#3203 2018-10-03 15:31:43

Registered: 2017-10-04
Posts: 7

Re: Post your handy self made command line utilities

And to be fair, learned something new again today. Of course there was an easier way wink


#3204 2018-10-05 08:47:36

Registered: 2008-11-14
Posts: 1,756

Re: Post your handy self made command line utilities

I've found this nice site that is missing an rss but gives you updates about new free games, so i wrote a little script that checks it and send me a notification when there is a new free game; didn't tested it deeply... yet!
It uses the handy "sendemail" tool from aur.

mkdir "$wdir" &>/dev/null
interval=7200 #secs

function notify() {
	 /usr/bin/sendEmail \
		-f \
		-t \
		-s \
		-xu gmail_username \
		-xp gmail_password \
		-u "GameCheck" \
		-m "New updates on:" 

function check_out() {
	curl "" |\
		tr "<" "\n"|\
		grep free |\
		grep "title\=" |\
		cut -d \" -f 2

check_out > "$f1"

while true ; do
	sleep $interval
	check_out > "$f2"
	if [ $(<"$f1") != $(<"$f2") ] ; then
		notify "$f2"
	cp "$f2" "$f1"

...and a systemd service as well

Description=Check for free games



Last edited by kokoko3k (2018-10-05 08:55:15)


Board footer

Powered by FluxBB