1 #! /usr/bin/ksh -p 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License (the "License"). 7 # You may not use this file except in compliance with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 23 # 24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved. 25 # Use is subject to license terms. 26 # 27 # ident "@(#)ce_file_exist.ksh 1.2 07/01/04 SMI" 28 # 29 30 # 31 # Function ce_file_exist 32 # 33 # This function checks whether the file exists 34 # 35 function ce_file_exist 36 { 37 print "checkenv: ce_file_exist($*)" 38 39 errmsg="usage: ce_file_exist <absolute_file_name>" 40 [ $# -ne 1 ] && abort $errmsg 41 42 req_label="the file exists or not" 43 req_value="exists" 44 45 if [ $OPERATION == "dump" ]; then 46 ce_file_exist_doc 47 return $PASS 48 fi 49 50 result=FAIL 51 if [ $OPERATION == "verify" ]; then 52 [[ -e $1 ]] && result=PASS 53 fi 54 55 print_line $TASK "$req_label" "$req_value" "$result" 56 eval return \$$result 57 } 58 59 function ce_file_exist_doc 60 { 61 cat >&1 << EOF 62 63 Check ce_file_exist 64 ================================= 65 Description: 66 check whether the file exists or not 67 Arguments: 68 #1 - the absolute file name 69 Requirement label (for this check): 70 $req_label 71 Requirement value (for this check): 72 $req_value 73 EOF 74 } 75