Convulated computer nerd command lines.
Used by Systems Administrators and the like to automate things
Used by Systems Administrators and the like to automate things
if you just use the below you can have a nice OS Version detector, basic Awksedreplgrep!
-e /etc/issue && \
-r /etc/redhat-release && \
OSRELEASE=$( head -q -n 1 /etc/issue /etc/redhat-release | /bin/sort -u | xargs |/usr/bin/perl -ne '$rel=(/3\.\d+/ ? 'c3' : (/4/ ? 'c4' : (/5/ ? 'c5' : (/release (\d).+update (\d+)/i ? "r$1" : (/Fed.+\b (\d+)/ ? 'fc' : (/Ub.+\b (\d+\.\d+)/ ? $1 : 'unk') ) ) ) ) );print "$rel\n";')
-e /etc/issue && \
-r /etc/redhat-release && \
OSRELEASE=$( head -q -n 1 /etc/issue /etc/redhat-release | /bin/sort -u | xargs |/usr/bin/perl -ne '$rel=(/3\.\d+/ ? 'c3' : (/4/ ? 'c4' : (/5/ ? 'c5' : (/release (\d).+update (\d+)/i ? "r$1" : (/Fed.+\b (\d+)/ ? 'fc' : (/Ub.+\b (\d+\.\d+)/ ? $1 : 'unk') ) ) ) ) );print "$rel\n";')
by hechz February 07, 2014