没有该文件则创建,有则 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

 

相关文章:

  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-15
  • 2021-12-07
  • 2022-12-23
相关资源
相似解决方案