Mins / TuxLite

A complete LAMP and LNMP setup script for Debian or Ubuntu
http://tuxlite.com
253 stars 112 forks source link

phpMyAdmin autoupdate to the newest version #31

Closed rindeal closed 10 years ago

Mins commented 10 years ago

This automation is really convenient! Thanks!

I wonder if this can be simplified a little to ease readability with the below codes. The first simply tidies up the regex a little. The second is a more straight forward approach. Trim off the whitespaces, and cut away the both ends of the unwanted HTML string. What do you think?

sed -r 's/^.\s([0-9.]).*/\1/' tr -d ' ' | cut -c 15- | cut -c -5

rindeal commented 10 years ago

Well, the sed doesn't work (at least for me) and the second example works but only until the version 4.1.10.

The only simplification I could come up with is this:

gawk 'match($0,/phpMyAdmin\s*([0-9.]+)/,a){print a[1];exit}'

combining grep and sed into one command

Mins commented 10 years ago

Looks like your original solution might be best after all. We can always revisit this if needs to be in the future.

Thanks again for the commit!