Linux ½Å±¾±àд»ù´¡(ËÄ)
4)º¯Êý
Èç¹ûÄúдÁËһЩÉÔ΢¸´ÔÓһЩµÄ³ÌÐò£¬Äú¾Í»á·¢ÏÖÔÚ³ÌÐòÖпÉÄÜÔÚ¼¸¸öµØ·½Ê¹ÓÃÁËÏàͬµÄ´úÂ룬²¢ÇÒÄúÒ²»á·¢ÏÖ£¬Èç¹ûÎÒÃÇʹÓÃÁ˺¯Êý£¬»á·½±ãºÜ¶à¡£Ò»¸öº¯ÊýÊÇÕâ¸öÑù×ӵģº
functionname()
{
# inside the body $1 is the first argument given to the function
# $2 the second ...
body
}
ÄúÐèÒªÔÚÿ¸ö³ÌÐòµÄ¿ªÊ¼¶Ôº¯Êý½øÐÐÉùÃ÷¡£
ÏÂÃæÊÇÒ»¸ö½Ð×öxtitlebarµÄ½Å±¾£¬Ê¹ÓÃÕâ¸ö½Å±¾Äú¿ÉÒԸıäÖն˴°¿ÚµÄÃû³Æ¡£
ÕâÀïʹÓÃÁËÒ»¸ö½Ð×öhelpµÄº¯Êý¡£ÕýÈçÄú¿ÉÒÔ¿´µ½µÄÄÇÑù£¬Õâ¸ö¶¨ÒåµÄº¯Êý±»Ê¹ÓÃÁËÁ½´Î¡£
#!/bin/sh
# vim: set sw=4 ts=4 et:
help()
{
cat <
xtitlebar -- change the name of an xterm, gnome-terminal or kde konsole
USAGE: xtitlebar [-h] "string_for_titelbar"
OPTIONS: -h help text
EXAMPLE: xtitlebar "cvs"
HELP
exit 0
}
# in case of error or if -h is given we call the function help:
[ -z "$1" ] && help
[ "$1" = "-h" ] && help
# send the escape sequence to change the xterm titelbar:
echo -e "33]0;$107"
#
Ôڽű¾ÖÐÌṩ°ïÖúÊÇÒ»Öֺܺõıà³ÌÏ°¹ß£¬ÕâÑù·½±ãÆäËûÓû§£¨ºÍÄú£©Ê¹ÓúÍÀí½â½Å±¾¡£
ÃüÁîÐвÎÊý
ÎÒÃÇÒѾ¼û¹ý$* ºÍ $1, $2 ... $9 µÈÌØÊâ±äÁ¿£¬ÕâЩÌØÊâ±äÁ¿°üº¬ÁËÓû§´ÓÃüÁîÐÐÊäÈëµÄ²ÎÊý¡£Æù½ñΪֹ£¬ÎÒÃǽö½öÁ˽âÁËһЩ¼òµ¥µÄÃüÁîÐÐÓï·¨£¨±ÈÈçһЩǿÖÆÐԵIJÎÊýºÍ²é¿´°ïÖúµÄ-hÑ¡Ï¡£µ«ÊÇÔÚ±àд¸ü¸´ÔӵijÌÐòʱ£¬Äú¿ÉÄܻᷢÏÖÄúÐèÒª¸ü¶àµÄ×Ô¶¨ÒåµÄÑ¡Ïͨ³£µÄ¹ßÀýÊÇÔÚËùÓпÉÑ¡µÄ²ÎÊý֮ǰ¼ÓÒ»¸ö¼õºÅ£¬ºóÃæÔÙ¼ÓÉϲÎÊýÖµ (±ÈÈçÎļþÃû)¡£Óкö෽·¨¿ÉÒÔʵÏÖ¶ÔÊäÈë²ÎÊýµÄ·ÖÎö£¬µ«ÊÇÏÂÃæµÄʹÓÃcase±í´ïʽµÄÀý×ÓÎÞÒÅÊÇÒ»¸ö²»´íµÄ·½·¨¡£
#!/bin/sh
help()
{
cat <
This is a generic command line parser demo.
USAGE EXAMPLE: cmdparser -l hello -f -- -somefile1 somefile2
HELP
exit 0
}
while [ -n "$1" ]; do
case $1 in
-h) help;shift 1;; # function help is called
-f) opt_f=1;shift 1;; # variable opt_f is set
-l) opt_l=$2;shift 2;; # -l takes an argument -> shift by 2
--) shift;break;; # end of options
-*) echo "error: no such option $1. -h for help";exit 1;;
*) break;;
esac
done
echo "opt_f is $opt_f"
echo "opt_l is $opt_l"
echo "first arg is $1"
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
Ê×ÏÈÐèÒªÏÂÔØLinux kernel£¬ÔÚwww.kernel.orgÀïÃæÏÂÔØ¡£È»ºóÐèÒª°²×°kernel-package£¬fakeroot¡£ÕâÑù×¼±¸¹¤×÷¾ÍÍê³ÉÁË¡£
ÏÂÃ濪ʼÄں˵ÄÅäÖá£×îÖØÒªµÄÒ»µãÊÇÈ¥µôkenerl hackingÑ¡ÏÏÂÃæµÄ“±àÒëÄں˴øÓÐdebugÐÅÏ¢”Ñ¡Ï·ñÔò±àÒë³öÀ´µÄÄÚºËÎÞ±ÈÅÓ´ó
¡£È»ºó¸ù¾Ý¸öÈËÐèҪȥµôһЩÇý¶¯¡£²»¹ý±ØÐëÇå³þÖªµÀ×Ô¼ ......
linuxĿ¼¼Ü¹¹
/ ¸ùĿ¼
/bin ³£ÓõÄÃüÁî binary file µÄÄ¿錄
/boot ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ (kernel) ÔÚÄÚ
/boot/grub/menu.lst GRUBÉèÖÃ
/ ......