题目
- shell脚本中单引号、双引号、反引号、转义字符、()、 { }的练习。
- 写一个shell脚本,测试一下在本网络中哪个ip地址是OK.
我的答案
shell脚本中单引号、双引号、反引号、转义字符、()、 { }的练习。
#! /bin/bash
name= teacher
string1="good moring $name”
string2= ' good moring $name'
echo $string1
echo $str ing2
echo "today is`date ` ”// 反括号``
echo ' today is date’
echo -e "this \n is\ta\ntest"
( name=s tudent;echo "1 $name”)
echo 1 : $name
{ name=student; echo "2 $name"; }
echo 2: $name

2 写一个shell脚本,测试一下在本网络中哪个ip地址是OK.
#! /bin/bash
for i in {0. .255}
do
{
ping -W 2 -C 10.0.0.${i} &>/dev/mull
if
$? -eq 0]
then
echo "10.0.0. ${i}OK"
fi
}&
done
sleep 2
