Want to format the output as a CSV
+26 −2 · 1 file changed
-
check_ver.sh+26 −2
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x if [ "$(uname -s)" == 'FreeBSD' ]; then OS='freebsd' elif [ -f "/etc/redhat-release" ]; then @@ -10,7 +10,6 @@ elif [ -f "/etc/redhat-release" ]; then esac elif [ -f "/etc/debian_version" ]; then OS=`echo -n Debian Version: && cat /etc/debian_version` - fi echo "$OS" @@ -23,3 +22,28 @@ ifconfig | awk 'BEGIN { FS = "\n"; RS = "" } { print $1 $2 }' | sed -e 's/ .*ine # nume servicii netstat -lp | cut -f2 -d'/' | awk '{print $1}'|grep -v -E '(avahi|Active|0|Program|getnameinfo failed)' | sort | uniq + +# Format +alias="ABCOMUPTER" +host="abccomputer.internal" +ip="127.0.0.1" +os="CentOS 5.0.2" +eth0="192.168.1.1" +eth1="172.16.20.25" +serv="http" +ver="2.2.4" + +_csvout() { +cat << EOF +Alias,Host,IP,OS Ver +$alias,$host,$ip,$os +Iface,,, +eth0,,$eth0, +eth1,,$eth1, +Service,,, +$serv, $ver,, +EOF + exit 1 + } + + _csvout()