如题所述
#!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/access.log" #è¿éç-x åæ°å¤æ$myPathæ¯å¦åå¨å¹¶ä¸æ¯å¦å
·æå¯æ§è¡æé if [ ! -x "$myPath"]; then mkdir "$myPath" fi #è¿éç-d åæ°å¤æ$myPathæ¯å¦åå¨ if [ ! -d "$myPath"]; then mkdir "$myPath" fi #è¿éç-fåæ°å¤æ$myFileæ¯å¦åå¨ if [ ! -f "$myFile" ]; then touch "$myFile" fi
温馨提示:答案为网友推荐,仅供参考
第1个回答 2017-01-01
您好,请问您是想知道shell判断文件,目录是否存在或者具有权限的代码吗?