没有该文件则创建,有则 ls -l 输出文件信息。
#!/bin/bash echo "enter the name:" read filename if test -e $filename ; then ls -l $filename else touch $filename fi
输出
enter the name: sss.sh -rwxr-xr-x 1 root root 147 Dec 3 09:02 sss.sh
没有该文件则创建,有则 ls -l 输出文件信息。
#!/bin/bash echo "enter the name:" read filename if test -e $filename ; then ls -l $filename else touch $filename fi
输出
enter the name: sss.sh -rwxr-xr-x 1 root root 147 Dec 3 09:02 sss.sh
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。