Linux ½Å±¾±àд»ù´¡(Èý)
3) Á÷³Ì¿ØÖÆ
1.if
"if" ±í´ïʽ Èç¹ûÌõ¼þÎªÕæÔòÖ´ÐÐthenºóÃæµÄ²¿·Ö£º
if ....; then
....
elif ....; then
....
else
....
fi
´ó¶àÊýÇé¿öÏ£¬¿ÉÒÔʹÓòâÊÔÃüÁîÀ´¶ÔÌõ¼þ½øÐвâÊÔ¡£±ÈÈç¿ÉÒԱȽÏ×Ö·û´®¡¢ÅжÏÎļþÊÇ·ñ´æÔÚ¼°ÊÇ·ñ¿É¶ÁµÈµÈ…
ͨ³£ÓÃ" [ ] "À´±íʾÌõ¼þ²âÊÔ¡£×¢ÒâÕâÀïµÄ¿Õ¸ñºÜÖØÒª¡£ÒªÈ·±£·½À¨ºÅµÄ¿Õ¸ñ¡£
[ -f "somefile" ] £ºÅжÏÊÇ·ñÊÇÒ»¸öÎļþ
[ -x "/bin/ls" ] £ºÅжÏ/bin/lsÊÇ·ñ´æÔÚ²¢ÓпÉÖ´ÐÐȨÏÞ
[ -n "$var" ] £ºÅжÏ$var±äÁ¿ÊÇ·ñÓÐÖµ
[ "$a" = "$b" ] £ºÅжÏ$aºÍ$bÊÇ·ñÏàµÈ
Ö´ÐÐman test¿ÉÒԲ鿴ËùÓвâÊÔ±í´ïʽ¿ÉÒԱȽϺÍÅжϵÄÀàÐÍ¡£
Ö±½ÓÖ´ÐÐÒÔϽű¾£º
#!/bin/sh
if [ "$SHELL" = "/bin/bash" ]; then
echo "your login shell is the bash (bourne again shell)"
else
echo "your login shell is not bash but $SHELL"
fi
±äÁ¿$SHELL°üº¬Á˵ǼshellµÄÃû³Æ£¬ÎÒÃǺÍ/bin/bash½øÐÐÁ˱Ƚϡ£
¿ì½Ý²Ù×÷·û
ÊìϤCÓïÑÔµÄÅóÓÑ¿ÉÄÜ»áºÜϲ»¶ÏÂÃæµÄ±í´ïʽ£º
[ -f "/etc/shadow" ] && echo "This computer uses shadow passwors"
ÕâÀï && ¾ÍÊÇÒ»¸ö¿ì½Ý²Ù×÷·û£¬Èç¹û×ó±ßµÄ±í´ïÊ½ÎªÕæÔòÖ´ÐÐÓұߵÄÓï¾ä¡£ÄúÒ²¿ÉÒÔÈÏΪÊÇÂß¼ÔËËãÖеÄÓë²Ù×÷¡£ÉÏÀýÖбíʾÈç¹û/etc/shadowÎļþ´æÔÚÔò´òÓ¡” This computer uses shadow passwors”¡£Í¬Ñù»ò²Ù×÷(||)ÔÚshell±à³ÌÖÐÒ²ÊÇ¿ÉÓõġ£ÕâÀïÓиöÀý×Ó£º
#!/bin/sh
mailfolder=/var/spool/mail/james
[ -r "$mailfolder" ]' '{ echo "Can not read $mailfolder" ; exit 1; }
echo "$mailfolder has mail from:"
grep "^from " $mailfolder
¸Ã½Å±¾Ê×ÏÈÅжÏmailfolderÊÇ·ñ¿É¶Á¡£Èç¹û¿É¶ÁÔò´òÓ¡¸ÃÎļþÖеÄ"from" Ò»ÐС£Èç¹û²»¿É¶ÁÔò»ò²Ù×÷ÉúЧ£¬´òÓ¡´íÎóÐÅÏ¢ºó½Å±¾Í˳ö¡£ÕâÀïÓиöÎÊÌ⣬ÄǾÍÊÇÎÒÃDZØÐëÓÐÁ½¸öÃüÁ
-´òÓ¡´íÎóÐÅÏ¢
-Í˳ö³ÌÐò
ÎÒÃÇʹÓû¨À¨ºÅÒÔÄäÃûº¯ÊýµÄÐÎʽ½«Á½¸öÃüÁî·Åµ½Ò»Æð×÷Ϊһ¸öÃüÁîʹÓá£Ò»°ãº¯Êý½«ÔÚÏÂÎÄÌá¼°¡£²»ÓÃÓëºÍ»ò²Ù×÷·û£¬ÎÒÃÇÒ²¿ÉÒÔÓÃif±í´ïʽ×÷ÈκÎÊÂÇ飬µ«ÊÇʹÓÃÓë»ò²Ù×÷·û»á¸ü±ãÀûºÜ¶à¡£
2.case
case :±í´ïʽ¿ÉÒÔÓÃÀ´Æ¥ÅäÒ»¸ö¸ø¶¨µÄ×Ö·û´®£¬¶ø²»ÊÇÊý×Ö¡£
case ... in
...) do something here ;;
esac
ÈÃÎÒÃÇ¿´Ò»¸öÀý×Ó¡£fileÃüÁî¿ÉÒÔ±æ±ð³öÒ»¸ö¸ø¶¨ÎļþµÄÎļþÀàÐÍ£¬±ÈÈ磺
file lf.gz
Õ⽫·µ»Ø£º
lf.gz: gzip compressed data, deflated, original filename,
last modified:
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
linuxÌí¼Ó·ÓÉ
http://baikgd.blog.163.com/blog/static/35402495200972111353827/
·þÎñÆ÷ip(eth0)
[root@localhost net]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:E3:9A:15
inet addr:172.18.3.205 Bcast:172.18.3.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fee3:9a15/64 Scope:Link
UP BR ......
Linux 2.6 ×Ö·ûÉ豸Çý¶¯³ÌÐò
¡ð¡¢ËµÃ÷
±Ê¼ÇÊÊÓÃÓÚLinuxµÄ2.6.10ÒÔºóµÄÄںˡ£
±Ê¼ÇÒÔLinux
Device
Driver3ÌṩµÄscull³ÌÐò(scullĿ¼ÖеÄmain.cºÍscull.h)Ϊ¼Ç¼Ö÷Ïߣ¬²¢ÒÔ¸ÃÇý¶¯³ÌÐòÖеĸ÷ÖÖϵͳµ÷Óúͺ¯Êýµ÷ÓÃÁ÷³ÌΪ¼Ç
¼˳Ðò¡£±ÈÈ磬module_init( )ºÍmodule_exit(
)ΪÏà¶ÔÓ¦µÄÒ»¶Ôϵͳµ÷Óã¬Ò»°ãÊé¼®Öж¼»á·ÅÔÚÒ ......
¡¡¡¡½ÓÏÂÀ´ÈýÐÐÉèÖÃÈýÖÖ¹¦ÄÜ£¬treeview.set_search_column(0)£¬µ±ÔÚ½çÃæÖа´“Control+F”ʱ¿ÉÒÔËÑË÷µÚ0ÁÐÖеÄÄÚÈÝ£¬tvcolumn.set_sort_column_id(0)£¬µ±µã»÷´ËÁбêÌâµÄʱºòËùÓеÄÐа´´óС˳ÐòÖØÐÂÅÅÁС£²ÎÊý0ÊÇ
ÁÐÔÚModelÀïµÄÐòºÅ¡£½ÓÏÂÀ´treeview.set_reorderable·½·¨Ê¹µÃ¿ÉÒÔÓÃÊó±êÍ϶¯ÐнøÐÐÖØÐÂÅÅÁУ¬±ÈÈç£ ......
½ø³Ìƪ
²é¿´Ä³½ø³Ì¶Ë¿ÚºÅ
netstat -anp | grep 80
lsof -i :port
Àý£º ×¢Òâ":"ºó£¬½ô¸ú¶Ë¿ÚºÅ£¬Ã»Óпոñ
#lsof -i :443
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
java 2731 root 35u IPv6 7778 TCP *:https (LI ......