2008-10-06 20:48:16 +00:00
|
|
|
#!/bin/sh
|
2008-07-16 18:31:52 +00:00
|
|
|
|
2009-01-10 12:38:13 +00:00
|
|
|
# colour definitions
|
|
|
|
normal="\033[0m"
|
|
|
|
red="\033[31m"
|
|
|
|
orange="\033[33m"
|
|
|
|
green="\033[32m"
|
|
|
|
|
|
|
|
if [ "foo`echo -e bar`" = "foobar" ];then
|
|
|
|
# GNU echo
|
|
|
|
ECHO_e="echo -e"
|
|
|
|
else
|
|
|
|
# POSIX echo
|
|
|
|
ECHO_e="echo"
|
|
|
|
fi
|
|
|
|
|
|
|
|
die() {
|
|
|
|
$ECHO_e "${red}$@${normal}" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2008-10-03 11:01:39 +00:00
|
|
|
if [ -f "${NEO_CONFIG}" ]; then
|
|
|
|
. "${NEO_CONFIG}" || die "Failed to source ${NEO_CONFIG}"
|
|
|
|
elif [ -f "${HOME}"/.neorc ]; then
|
2009-01-10 12:38:13 +00:00
|
|
|
. "${HOME}"/.neorc || die "Failed to source ${HOME}/.neorc"
|
2008-10-03 11:01:39 +00:00
|
|
|
elif [ -f /etc/neo.conf ]; then
|
|
|
|
. /etc/neo.conf || die "Failed to source /etc/neo.conf"
|
|
|
|
else
|
|
|
|
echo "No configuration file found. Using default values, this might fail!"
|
|
|
|
fi
|
|
|
|
|
2008-10-06 20:33:51 +00:00
|
|
|
NEO_REFERENCE=${NEO_REFERENCE:-$HOME/neo/neo20.txt}
|
2008-07-16 18:31:52 +00:00
|
|
|
|
2008-07-16 19:25:18 +00:00
|
|
|
if [ 0 = $# ]; then
|
2009-01-05 12:22:32 +00:00
|
|
|
grep -m 1 -B 15 "┴───────┘" "${NEO_REFERENCE}"
|
2008-07-16 18:31:52 +00:00
|
|
|
else
|
|
|
|
for NUM in $@; do
|
|
|
|
if [ $(($NUM)) -ge 1 -a $(($NUM)) -le 6 ]; then
|
2008-10-03 11:01:39 +00:00
|
|
|
grep -B 11 -m "$NUM" "└───────┴───┴───┘" "${NEO_REFERENCE}" | tail -n 12
|
2008-07-16 18:31:52 +00:00
|
|
|
else
|
|
|
|
echo "Benutzung: `basename $0` [1-6]"
|
|
|
|
echo " Wenn der Aufruf ohne Zahl erfolgt, werden alle Ebenen ausgegeben."
|
|
|
|
echo " Ansonsten werden nur die Ebenen ausgegeben, die angegeben sind."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|