From b892d46f8b3b1f479f7e4eb7a7599bc3d0e8c838 Mon Sep 17 00:00:00 2001 From: knittl Date: Fri, 3 Oct 2008 11:01:39 +0000 Subject: [PATCH] =?UTF-8?q?neo.conf=20ins=20(richtige)=20verzeichnis=20etc?= =?UTF-8?q?=20verschoben=20patch=20von=20bernd=20f=C3=BCr=20num=20und=20ne?= =?UTF-8?q?o=20eingespielt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- linux/bin/neo | 17 +++++++++++++---- linux/bin/num | 17 +++++++++++++---- linux/{bin => etc}/neo.conf | 0 3 files changed, 26 insertions(+), 8 deletions(-) rename linux/{bin => etc}/neo.conf (100%) diff --git a/linux/bin/neo b/linux/bin/neo index 89237062..2753971b 100755 --- a/linux/bin/neo +++ b/linux/bin/neo @@ -1,14 +1,23 @@ #!/bin/sh -# Verzeichnis muss eventuell an den Ort der neo20.txt angepasst werden: -NEO_TXT=$HOME/neo/A-REFERENZ-A/neo20.txt +if [ -f "${NEO_CONFIG}" ]; then + . "${NEO_CONFIG}" || die "Failed to source ${NEO_CONFIG}" +elif [ -f "${HOME}"/.neorc ]; then + . "${HOME}"/.neorc || die "Failed to source ${HOME}/.neorc" +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 + +NEO_REFERENCE=${NEO_REFERENCE:-/usr/share/neo-layout/neo20-reference.txt} if [ 0 = $# ]; then - grep -m 1 -B 15 "┴──────┘" $NEO_TXT + grep -m 1 -B 15 "┴──────┘" "${NEO_REFERENCE}" else for NUM in $@; do if [ $(($NUM)) -ge 1 -a $(($NUM)) -le 6 ]; then - grep -B 11 -m "$NUM" "└───┴──┴──┴───────────┴──┴──┴──┴───┘" $NEO_TXT | tail -n 12 + grep -B 11 -m "$NUM" "└───┴──┴──┴───────────┴──┴──┴──┴───┘" "${NEO_REFERENCE}" | tail -n 12 else echo "Benutzung: `basename $0` [1-6]" echo " Wenn der Aufruf ohne Zahl erfolgt, werden alle Ebenen ausgegeben." diff --git a/linux/bin/num b/linux/bin/num index 371feb50..16ed8e9f 100755 --- a/linux/bin/num +++ b/linux/bin/num @@ -1,14 +1,23 @@ #!/bin/sh -# Verzeichnis muss eventuell an den Ort der neo20.txt angepasst werden: -NEO_TXT=$HOME/neo/A-REFERENZ-A/neo20.txt +if [ -f "${NEO_CONFIG}" ]; then + . "${NEO_CONFIG}" || die "Failed to source ${NEO_CONFIG}" +elif [ -f "${HOME}"/.neorc ]; then + . "${HOME}"/.neorc || die "Failed to source ${HOME}/neo.conf" +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 + +NEO_REFERENCE=${NEO_REFERENCE:-/usr/share/neo-layout/neo20-reference.txt} if [ 0 = $# ]; then - grep -m 1 -B 15 "┴───────┘" $NEO_TXT + grep -m 1 -B 15 "┴───────┘" "${NEO_REFERENCE}" else for NUM in $@; do if [ $(($NUM)) -ge 1 -a $(($NUM)) -le 6 ]; then - grep -B 11 -m "$NUM" "└───────┴───┴───┘" $NEO_TXT | tail -n 12 + grep -B 11 -m "$NUM" "└───────┴───┴───┘" "${NEO_REFERENCE}" | tail -n 12 else echo "Benutzung: `basename $0` [1-6]" echo " Wenn der Aufruf ohne Zahl erfolgt, werden alle Ebenen ausgegeben." diff --git a/linux/bin/neo.conf b/linux/etc/neo.conf similarity index 100% rename from linux/bin/neo.conf rename to linux/etc/neo.conf