Linux Shell ±Ê¼Ç¶þ(Ñ»·½á¹¹)
³ÌÐò12£ºÀàËÆjava ÀïÃæµÄswitch case
[root@localhost scripts]# cat sh12.sh
read -p "input comand:" command
case $command in
"fix")
echo "fix system"
;;
"fuck")
echo "fuck you"
;;
*)
echo "what a stupid man!ex>$0 some word"
esac
exit 0
³ÌÐò13£º¼òµ¥¼òµ¥£¬³¬¼¶¼òµ¥µÄÒ»¸öº¯Êý
[root@localhost scripts]# cat sh13.sh
function printit()
{
echo -n "Your choice is $1"
}
#$1Ϊ¿ØÖÆÌ¨ÊäÈëµÄµÚ¶þ¸ö²ÎÊý
printit 1;echo $1 | tr 'a-z' 'A-Z'
³ÌÐò14:until do done
[root@localhost scripts]# cat sh14.sh
until [ "$yn" = "yes" ] || [ "$yn" == "YES" ]
do
read -p "please input yes/to stop this program:" yn
done
³ÌÐò15£ºwhile do done
[root@localhost scripts]# cat sh15.sh
s=0
i=0
while [ "$i" != "100" ]
do
i=$(($i+1))
s=$(($s+$i))
done
echo "number of 1+2+3+...+100=$s"
³ÌÐò16£ºfor do done
[root@localhost scripts]# cat sh16.sh
s=0
for((i=1;i<=100;i=i+1))
do
s=$(($s+$i))
done
echo $s
exit 0
³ÌÐò17:for do done(2)
[root@localhost scripts]# cat sh17.sh
for animal in dog cat elephant
do
echo "there are ""$animal"
done
exit 0
³ÌÐò18£ºÀûÓà for do done²éÕÒijһ¸öĿ¼ÏÂÃæµÄÎļþȨÏÞÐÅÏ¢
[root@localhost scripts]# cat sh18.sh
read -p "input a directory:" dir
if [ "$dir" == "" ] || [ ! -d "$dir" ]; then
echo "The $dir is not exist in the system"
exit 1
fi
echo `ls $dir`
filelist=`ls $dir`
for filename in $filelist
do
perm="";
test -r "$dir/$filename" && perm="$perm readable"
test -w "$dir/$filename" && perm="$perm writable"
test -x "$dir/$filename" && perm="$perm execuatable"
echo "The file $dir/$filename's permission is $perm"
done
Ïà¹ØÎĵµ£º
×ÜÀÀ
ÓÃiptables -ADC À´Ö¸¶¨Á´µÄ¹æ
Ôò
£¬-AÌí¼Ó -Dɾ³ý -C ÐÞ¸Ä
iptables - [RI] chain rule num rule-specification[option]
ÓÃiptables - RI ͨ¹ý¹æÔòµÄ˳ÐòÖ¸¶¨
iptables -D chain rule num[option]
ɾ³ýÖ¸¶¨¹æÔò
iptables -[LFZ] [chain][option]
ÓÃiptables -LFZ Á´Ãû [Ñ¡Ïî]
iptables -[NX] chain
ÓÃ -NX ......
Ò»¡¢Ê¹ÓÃÃüÁîÉèÖÃubuntuµÄipµØÖ·
1.ÐÞ¸ÄÅäÖÃÎļþblacklist.conf½ûÓÃIPV6£º
sudo vi /etc/modprobe.d/blacklist.conf
2.ÔÚÎĵµ×îºóÌí¼Ó blacklist ipv6£¬È»ºó²é¿´Ð޸Ľá¹û£º
cat /etc/modprobe.d/blacklist.conf
3.ÉèÖÃIP£¨ÉèÖÃÍø¿¨eth0µÄIPµØÖ·ºÍ×ÓÍøÑÚÂ룩
sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0 ......
¹²Ïí¿âµÄÃüÃû¹ßÀý
°´ÕÕ¹²Ïí¿âµÄÃüÃû¹ßÀý£¬Ã¿¸ö¹²Ïí¿âÓÐÈý¸öÎļþÃû£ºreal name¡¢sonameºÍlinker
name¡£ÕæÕýµÄ¿âÎļþ£¨¶ø²»ÊÇ·ûºÅÁ´½Ó£©µÄÃû×ÖÊÇreal
name£¬°üº¬ÍêÕûµÄ¹²Ïí¿â°æ±¾ºÅ¡£ÀýÈçÉÏÃæµÄlibcap.so.1.10¡¢libc-2.8.90.soµÈ¡£
sonameÊÇÒ»¸ö·ûºÅÁ´½ÓµÄÃû×Ö£¬Ö»°üº¬¹²Ïí¿âµÄÖ÷°æ±¾ºÅ£¬Ö÷°æ±¾ºÅÒ»Ö¼´¿É±£Ö¤¿âº¯ÊýµÄ½Ó¿ ......
¼ò½é
Basic ÊÇʹÓõÄ×î¹ã·ºµÄ¡¢×î¼òµ¥µÄ±à³ÌÓïÑÔÖ®Ò»£¬ÓÈÆäÊǶÔÓÚÐÂÊÖ¡£ Æù½ñΪֹ£¬×î³£ÓÃµÄ Basic ¿ª·¢»·¾³ÊÇ Microsoft µÄ Visual Basic ¼¯³É¿ª·¢»·¾³¡£ ½üÀ´£¬Linux µÄʹÓ÷¶Î§ÒѾÑÓÉìµ½ÁË×ÀÃæ»·¾³¡£´Ó×î³õµÄ½öÏÞÓÚ·þÎñÆ÷Ó¦Óã¬Ê¹µÃÈ˶¼ÊÇÁìµ¼Õߣ¬ËüÕýÔÚ±ä³ÉÒ»¸ö¿Í»§¶Ë¼ÆËã»úµÄ²Ù×÷ϵͳ£¬Âú×ãÁËÀàËÆÔĶÁµç×ÓÓʼþ¡¢ÉÏÍø ......