summaryrefslogtreecommitdiff
path: root/scripts/vyatta-exists
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-08-24 12:15:06 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-08-24 12:15:06 -0700
commit29662246b32dd27b2540ae766684f2c634e8d044 (patch)
treeaa8fdbf702d7363ba4eb1804d65f5696f62c3647 /scripts/vyatta-exists
parentb21ed5d3b9df3b347c2efd8341fb042469a3aaee (diff)
downloadvyatta-cfg-29662246b32dd27b2540ae766684f2c634e8d044.tar.gz
vyatta-cfg-29662246b32dd27b2540ae766684f2c634e8d044.zip
Add a small script to test for node existance
This does the same thing as vyatta-quagga-utils.pl --exists, but it is generally useful (outside quagga) and has less overhead than a perl compile.
Diffstat (limited to 'scripts/vyatta-exists')
-rwxr-xr-xscripts/vyatta-exists14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/vyatta-exists b/scripts/vyatta-exists
new file mode 100755
index 0000000..ef2dea3
--- /dev/null
+++ b/scripts/vyatta-exists
@@ -0,0 +1,14 @@
+#! /bin/bash
+
+# Test if given node exists in Vyatta config hierarchy
+#
+# if vyatta-exists interfaces wireless
+
+if [ -z "$VYATTA_TEMP_CONFIG_DIR" ]; then
+ echo "$0: not in configuration mode" 1>&2;
+ exit 1;
+fi
+IFS=/
+node=$*
+IFS=
+exec test -d $VYATTA_TEMP_CONFIG_DIR/$node