小编sem*_*ius的帖子

如果file存在且不为空.总是给我错误的价值

我有一个bash脚本:

 echo " enter file name "
 read $file
 if [ -f "$file" ] && [ -s "$file" ]
 then 
    echo " file does not exist, or is empty "
 else
    echo " file exists and is not empty "
 fi
Run Code Online (Sandbox Code Playgroud)

无论我输入什么$file,它都给了我错误的价值.我甚至可以输入一个甚至不存在的文件,它仍然会给我错误的价值.为什么那些家伙?提前致谢

linux bash scripting

35
推荐指数
2
解决办法
6万
查看次数

Bash读取用户y/n应答不起作用(在循环读取查找输出时读取命令)

我这里有问题.好像我的Bash脚本忽略了do和之间的所有内容done.不知道为什么,也许你会看到问题.提前致谢.

katalogas=$1
find $katalogas -type f -mtime +3 | while read $failai
do
read -p "Run command $foo? [yn]" answer
if [[ $answer = y ]] ; then
  rm $failai
fi
done
Run Code Online (Sandbox Code Playgroud)

linux bash

5
推荐指数
1
解决办法
2953
查看次数

如何在 CSS/HTML 中的菜单项之间留出空间

问题:菜单项之间无法留出空间(至少 1 厘米)。

\n

我是初学者,刚刚学习。我知道这个问题对于有经验的用户来说听起来很愚蠢。

\n

这是代码:

\n

\r\n
\r\n
body {\n  height: auto;\n  width: auto;\n  background-image: url("img/top.png");\n}\n\n.header {\n  margin: 0px auto;\n  max-width: 960px;\n}\n\n#header {\n  height: 300px;\n  width: 960px;\n  background-image: url("img/top.png")\n}\n\n#menu ul {\n  margin: 0px auto;\n  margin-left: -20px;\n  /*pull towards left*/\n  margin-right: 20px;\n  /*push towards right*/\n  list-style: none;\n  background: #3d3d5c;\n}\n\n#menu li {\n  display: inline-block;\n}\n\n#menu li a {\n  margin-left: -40px;\n  color: #fff;\n  text-decoration: none;\n  display: block;\n  background: red;\n  padding: 0 10px 0 10px;\n  height: 54px;\n  width: 130px;\n  line-height: 54px;\n}\n\n#menu li a:hover …
Run Code Online (Sandbox Code Playgroud)

html css

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

bash ×2

linux ×2

css ×1

html ×1

scripting ×1