安装了Fedora 5,乱点一通安装速度太慢啊,等了差不多两小时,以为全部安装了,进去一看,只装了Gnome等,总共2。9G。乱试一下gawk,把KDE有关的全装 #学习记录
#!/bin/bash
#linux修改Mac,自动更改
#首先必须关闭网卡eth0,否则可能会报告系统忙,无法更改。
#命令是:
ifconfig eth0 down
SLEEP_TIME=`expr $RANDOM % 99`
echo $SLEEP_TIME | gawk '{printf "ifconfig eth0 hw ether 00:01:12:55:00:"$0}'| gawk '{print$0; system($0)}'
#ifconfig eth0 hw ether 00:01:12:55:00:$1
ifconfig eth0 up
service network restart
#网卡的 MAC 地址更改就完成了。 #!/bin/bash
#文件uninstall
#用法./uninstall kde
ip=`rpm -qa |grep $1`
i=0
for X in $ip; do
echo $X
i=`expr $i "+" 1`
done
echo ""
echo "count:"$i
i=0
for X in $ip; do
echo ""
i=`expr $i "+" 1`
echo "$i.uninstall "$X
select var in "yes" "no" ; do
break
done
if [ $var = "yes" ];then
echo $X | gawk '{printf "yes ...";id="rpm -e "$0;system(id);print "ok"}'
else
echo "no ..."
fi
var="no"
done 脚本很好
照单全收 8错,学习。。 #!/bin/bash
#文件uninstall
#用法./uninstall kde
ip=`rpm -qa |grep $1`
i=0
for X in $ip; do
echo $X
i=`expr $i "+" 1`
done
echo ""
echo "count:"$i
i=0
for X in $ip; do
echo ""
i=`expr $i "+" 1`
echo "$i.uninstall "$X
select var in "yes" "no" ; do
break
done
#用if有点问题,改用case
case $var in
"yes")
echo $X| gawk '{printf "yes ...";id="rpm -e "$0;system(id);print "ok"}'
;;
*)
echo "no ..."
;;
esac
done #!/bin/bash
#文件名install
#用法:./install /mnt/hda5/MagicLinux-2.0-1.iso 或./install /mnt/hda5/MagicLinux-2.0-1.iso kde 戓./install /home
iso=`echo $1 |gawk '{if(length($0)-3 == index($0,".iso"))print "iso"}'`
dr=""
case $iso in
"iso")
echo `basename $1` $1 | gawk '{id="mkdir /tmp/"$1;system(id);id2="mount "$2 " /tmp/"$1 " -o loop";system(id2)}'
#echo `basename $1` | gawk '{id="umount -f /tmp/"$1;system(id);id2="rmdir /tmp/"$1;system(id2)}'
dr=`basename $1 | gawk '{id="/tmp/"$0;print id;}'`
;;
*)
dr=$1
;;
esac
case $2 in
"*")
ip=`find $dr -name "*.rpm"`
;;
"")
ip=`find $dr -name "*.rpm"`
;;
*)
ip=`find $dr -name "*.rpm" | grep $2`
;;
esac
i=0
for X in $ip; do
echo $X
i=`expr $i "+" 1`
done
echo ""
echo "count:"$i
i=0
for X in $ip; do
echo ""
i=`expr $i "+" 1`
echo "$i.install "$X
select var in "yes" "no" ; do
break
done
case $var in
"yes")
echo $X| gawk '{printf "yes ...";id="rpm -Uvh "$0;system(id);print "ok"}'
;;
*)
echo "no ..."
;;
esac
done
case $iso in
"iso")
#echo `basename $1` $1 | gawk '{id="mkdir /tmp/"$1;system(id);id2="mount "$2 " /tmp/"$1 " -o loop";system(id2)}'
echo `basename $1` | gawk '{id="umount -f /tmp/"$1;system(id);id2="rmdir /tmp/"$1;system(id2)}'
;;
*)
;;
esac 对Iptables的认识
以人才招聘作比喻
*nat相当于报名
*filter相当于检查
首先报名,要什么工作就发什么报名卡,呵,DNAT的作用(用在PREROUTING),SNAT(用在POSTROUTING),指导什么时候去哪上班。OUTPUT是自己人要出去下岗分流。
有了报名卡,就到单位面试,FORWARD代表能不能到本单位下属部门工作,INPUT允许到本单位总部工作,OUTPUT把总部工作的下岗分流。
不知道对不对。
页:
1
[2]