filecheck

来自「UNIX[1].shell范例精解(第4版)_code」· 代码 · 共 30 行

TXT
30
字号
#!/bin/ksh# Scriptname: filecheck# Purpose: Check to see if a file exists,what type it is,# and its permissions.file=$1      # Variable is set to first command line argumentif [[ ! -a $file ]]then	print "$file does not exist"	exit 1fiif [[ -d $file ]] then	print "$file is a directory" elif [[ -f $file ]]then 	if [[ -r $file && -w $file && -x $file ]] 	then 		print "You have read, write, and execute permission on 		file $file"	else		print "You don't have the correct permissions"		exit 2	fielse	print "$file is neither a file nor a directory. "	exit 3fi

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?