Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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:


Ïà¹ØÎĵµ£º

linuxÏÂÐźŴ¦Àí

Ç°ÑÔ£ºÕâÒ»ÕÂÎÒÃÇÌÖÂÛÒ»ÏÂLinuxϵÄÐźŴ¦Àíº¯Êý¡£  
LinuxϵÄÐźŴ¦Àíº¯Êý£º  
ÐźŵIJúÉú  
ÐźŵĴ¦Àí  
ÆäËüÐźź¯Êý  
Ò»¸öʵÀý  
1.ÐźŵIJúÉú  
LinuxϵÄÐźſÉÒÔÀà±ÈÓÚDOSϵÄINT»òÕßÊÇWindowsϵÄʼþ¡£ÔÚÓÐÒ»¸öÐźŷ¢ÉúʱºòÏàÐÅ ......

linuxĿ¼¼Ü¹¹ [×ÔÓÃ]

linuxĿ¼¼Ü¹¹ 
/       ¸ùĿ¼ 
/bin         ³£ÓõÄÃüÁî   binary   file   µÄÄ¿錄 
/boot       ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ   (kernel)   ÔÚÄÚ 
          /boot/gru ......

Linux±Ê¼Ç


linuxĿ¼¼Ü¹¹
/   ¸ùĿ¼
/bin    ³£ÓõÄÃüÁî
binary file µÄÄ¿錄
/boot   ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ
(kernel) ÔÚÄÚ
     /boot/grub/menu.lst   GRUBÉèÖÃ
     /boot/vmlinuz   ÄÚºË
  ......

linuxµÍ¶ËÄÚ´æÓùâºó»áµ¼ÖÂoom killerËæ»úkillµô½ø³Ì

µ±ÄÚ´æ³öÏÖ²»¹»ÓõÄʱºò£¬oom-killer»ákillµôһЩ½ø³Ì
Õâ¸öÐÅÏ¢¿ÉÒÔÔÚ/var/log/messgerÀï²éµ½
µ±ÕâÖÖÇé¿ö³öÏÖµÄʱºò£¬¿ÉÒÔ½«ÏµÍ³ÀïһЩnattachΪ0µÄshmÇåÀíµô
¹ØÓڸߵͶËÄÚ´æµÄÎÊÌâ¿ÉÒÔ¿´ÈçÏÂ
Since this problem seems to popup on different lists, this message has
been cross-posted to the general Red Hat disc ......

Linux 2.6 ×Ö·ûÉ豸Çý¶¯³ÌÐò


Linux 2.6 ×Ö·ûÉ豸Çý¶¯³ÌÐò
¡ð¡¢ËµÃ÷
±Ê¼ÇÊÊÓÃÓÚLinuxµÄ2.6.10ÒÔºóµÄÄںˡ£
±Ê¼ÇÒÔLinux
Device
Driver3ÌṩµÄscull³ÌÐò(scullĿ¼ÖеÄmain.cºÍscull.h)Ϊ¼Ç¼Ö÷Ïߣ¬²¢ÒÔ¸ÃÇý¶¯³ÌÐòÖеĸ÷ÖÖϵͳµ÷Óúͺ¯Êýµ÷ÓÃÁ÷³ÌΪ¼Ç
¼˳Ðò¡£±ÈÈ磬module_init( )ºÍmodule_exit(
)ΪÏà¶ÔÓ¦µÄÒ»¶Ôϵͳµ÷Óã¬Ò»°ãÊé¼®Öж¼»á·ÅÔÚÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ