diff bin/moeauto-genlink @ 124:5bafb912837e

Massive addition of old scripts collection.
author Edho Prima Arief <edho@myconan.net>
date Wed, 26 Oct 2011 15:22:00 +0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/moeauto-genlink	Wed Oct 26 15:22:00 2011 +0700
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ "$#" -lt 1 ]; then
+	cat <<EOF
+Usage: $(basename -- "$0")
+EOF
+	exit 1
+fi
+
+if [ ! -r "$*" ] || [ -d "$*" ]; then
+	cat <<EOF
+File "$*" can't be read!
+EOF
+	exit 1
+fi
+
+SERVER=
+while read LINE; do
+	if [ -n "$(printf "%s" "${LINE}" | grep "^SERVER=")" ]; then
+		SERVER=$(printf "%s" "${LINE}" | sed -e 's/SERVER=//')
+	else
+		[ -n "${SERVER}" ] && [ ! -z "$(printf "%s" "${LINE}" | grep -v "^$")" ] && moefetch check -s "${SERVER}" ${LINE}
+	fi
+done < "$*"