linux ifÃüÁî
linux ifÃüÁî
ÎÞÂÛʲô±à³ÌÓïÑÔ¶¼Àë²»¿ªÌõ¼þÅжϡ£SHELLÒ²²»ÀýÍâ¡£
if list then
do something here
elif list then
do another thing here
else
do something else here
fi
EX1:
#!/bin/sh
SYSTEM=`uname -s` #»ñÈ¡²Ù×÷ϵͳÀàÐÍ£¬ÎÒ±¾µØÊÇlinux
if [ $SYSTEM = "Linux" ] ; then #Èç¹ûÊÇlinuxµÄ»°´òÓ¡linux×Ö·û´®
echo "Linux"
elif [ $SYSTEM = "FreeBSD" ] ; then
echo "FreeBSD"
elif [ $SYSTEM = "Solaris" ] ; then
echo "Solaris"
else
echo "What?"
fi #ifend
»ù±¾ÉϺÍÆäËû½Å±¾ÓïÑÔÒ»Ñù¡£Ã»ÓÐÌ«´óÇø±ð¡£²»¹ýÖµµÃ×¢ÒâµÄÊÇ¡£[]ÀïÃæµÄÌõ¼þÅжϡ£
1 ×Ö·û´®ÅжÏ
str1 = str2¡¡¡¡¡¡¡¡¡¡¡¡µ±Á½¸ö´®ÓÐÏàͬÄÚÈÝ¡¢³¤¶ÈʱΪÕæ
str1 != str2¡¡¡¡¡¡¡¡¡¡ µ±´®str1ºÍstr2²»µÈʱΪÕæ
-n str1¡¡¡¡¡¡¡¡¡¡¡¡¡¡ µ±´®µÄ³¤¶È´óÓÚ0ʱΪÕæ(´®·Ç¿Õ)
-z str1¡¡¡¡¡¡¡¡¡¡¡¡¡¡ µ±´®µÄ³¤¶ÈΪ0ʱΪÕæ(¿Õ´®)
str1¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ µ±´®str1Ϊ·Ç¿ÕʱΪÕæ
2 Êý×ÖµÄÅжÏ
int1 -eq int2¡¡¡¡¡¡¡¡Á½ÊýÏàµÈΪÕæ
int1 -ne int2¡¡¡¡¡¡¡¡Á½Êý²»µÈΪÕæ
int1 -gt int2¡¡¡¡¡¡¡¡int1´óÓÚint2ΪÕæ
int1 -ge int2¡¡¡¡¡¡¡¡int1´óÓÚµÈÓÚint2ΪÕæ
int1 -lt int2¡¡¡¡¡¡¡¡int1СÓÚint2ΪÕæ
int1 -le int2¡¡¡¡¡¡¡¡int1СÓÚµÈÓÚint2ΪÕæ
3 ÎļþµÄÅжÏ
-r file¡¡¡¡¡¡¡¡¡¡Óû§¿É¶ÁΪÕæ
-w file¡¡¡¡¡¡¡¡¡¡Óû§¿ÉдΪÕæ
-x file¡¡¡¡¡¡¡¡¡¡Óû§¿ÉÖ´ÐÐΪÕæ
-f file¡¡¡¡¡¡¡¡¡¡ÎļþΪÕý¹æÎļþΪÕæ
-d file¡¡¡¡¡¡¡¡¡¡ÎļþΪĿ¼ΪÕæ
-c file¡¡¡¡¡¡¡¡¡¡ÎļþΪ×Ö·ûÌØÊâÎļþΪÕæ
-b file¡¡¡¡¡¡¡¡¡¡ÎļþΪ¿éÌØÊâÎļþΪÕæ
-s file¡¡¡¡¡¡¡¡¡¡Îļþ´óС·Ç0ʱΪÕæ
-t file¡¡¡¡¡¡¡¡¡¡µ±ÎļþÃèÊö·û(ĬÈÏΪ1)Ö¸¶¨µÄÉ豸ΪÖÕ¶ËʱΪÕæ
3 ¸´ÔÓÂß¼ÅжÏ
-a ¡¡ ¡¡¡¡¡¡¡¡¡¡ Óë
-o¡¡¡¡¡¡¡¡¡¡¡¡¡¡ »ò
!¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡·Ç
½áβ
Óï·¨ËäÈ»¼òµ¥£¬µ«ÊÇÔÚSHELLÀïʹÓõÄʱºò£¬ËûµÄ¹¦ÄܱäµÃÇ
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
ÏÂÃæµÄ´úÂë·ÖÎöÊǸù¾Ýlinux-2.6.17.14_stm22°æ±¾
#define STSYS_WriteRegDev32LE(Address_p, value) writel((u32)value, (void*)Address_p)
ÔÚinclude/asm-sh/io.h
#define writel(v,a) ({__raw_writel((v),(a));mb();})
#define __raw_write(v,a) __writ ......
Ôʼ¶¨Òå:include/linux/init.h
__initºÍ__exit±ê¼Çº¯Êý£¬__initdataºÍ__exitdata±ê¼ÇÊý¾Ý¡£
´Ëºê¶¨Òå¿ÉÖª±ê¼ÇºóµÄº¯ÊýÓëÊý¾ÝÆäʵÊǷŵ½ÁËÌض¨µÄ£¨´úÂë»òÊý¾Ý£©¶ÎÖС£±ê¼ÇΪ³õʼ»¯µÄº¯Êý,±íÃ÷¸Ãº¯Êý¹©ÔÚ³õʼ»¯ÆÚ¼äʹÓá£ÔÚÄ£¿é×°ÔØÖ®ºó£¬Ä£¿é×°ÔؾͻὫ³õʼ»¯º¯ÊýÈÓµô¡£ÕâÑù¿ÉÒÔ½«¸Ãº¯ÊýÕ¼ÓõÄÄÚ´æÊͷųöÀ´¡£
__ ......
http://linux.vbird.org/linux_server/0140networkcommand.php
ʹÓ÷ÓÉ·½Ê½£¬Ê¹ÓÃrouteÃüÁî¡£
-- RouteÃüÁîµÄÕýÈ·Ó÷¨
ʹÓà Route ÃüÁîÐй¤¾ß²é¿´²¢±à¼¼ÆËã»úµÄ IP ·ÓÉ±í¡£Route ÃüÁîºÍÓï·¨ÈçÏÂËùʾ£º
route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]
-f Ç ......