📄 test_query
字号:
#!/bin/bash#/*****************************************************************************# * Description: scripting shell for slp_client - generates an slp QUERY # *# * Originated: May 16, 2003# * Original Author: Mike Day md@soft-hackle.net# * mdday@us.ibm.com# *# * $Header: /cvs/MSB/pegasus/src/slp/slp_client/scripts/test_query,v 1.1 2003/12/17 18:05:31 tony Exp $ # * # * Copyright (c) 2003 IBM # * Copyright (c) 2003 Michael Day # * # * Permission is hereby granted, free of charge, to any person obtaining a # * copy of this software and associated documentation files (the "Software"),# * to deal in the Software without restriction, including without limitation # * the rights to use, copy, modify, merge, publish, distribute, sublicense, # * and/or sell copies of the Software, and to permit persons to whom the # * Software is furnished to do so, subject to the following conditions: # * # * The above copyright notice and this permission notice shall be included in # * all copies or substantial portions of the Software.# * # * # * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL# * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER# * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING# * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER# * DEALINGS IN THE SOFTWARE.# *# *****************************************************************************/############################################################################ This script shows how to use the slp_query command and tests the parameters# of a service request. Use it to verify your parameters are correct. To # do an actual slp query, omit the --test command line option from the # slp_query command below. ## Usage: # # test_query -t <type> [-p <predicate>] [-s <scopes>]# # type: a valid service type string. Service type strings# may contain wildcards. e.g., -t"*" will match any# service type. "*" and "?" are valid wildcards. # # predicate: an optional LDAP filter string. See # ftp://ftp.rfc-editor.org/in-notes/rfc2254.txt## scopes: an optional SLP list string. It must be in the form# "scope1[, scope2[, scope n] ]. e.g., "admin, eng, account"############################################################################PREDICATE=""SCOPE=""TYPE=""while getopts ":t:p:s:" opt; do case $opt in t ) TYPE=$OPTARG ;; p ) PREDICATE=$OPTARG ;; s ) SCOPE=$OPTARG ;; \? ) echo 'usage: test_query -t<type> -p<predicate> -s<scope> ' exit 1 esacdone shift $(($OPTIND - 1))echo "Testing a Service Request: "echo " Type: " "$TYPE"echo " Predicate: " "$PREDICATE"echo " Scopes: " "$SCOPE" slp_query --type="$TYPE" --predicate="$PREDICATE" --scopes="$SCOPES" --testcase $? in 0 ) echo "Service Request is valid" exit 0;; 1) echo "Service Type string (and possibly other strings) is invalid" exit 1;; 2) echo "Predicate string (and possibly the scope string) is invalid" exit 1;; 3) echo "Scope string is invalid" exit 1;;esac
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -