linux shell½Å±¾Ö®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¡¡¡¡¡¡¡¡¡¡¡¡¡¡ »ò
!¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡·Ç
ÓÐʱ¿´½Å±¾µÄʱºò²»ÖªµÀ¾ßÌåµÄÅжÏÊÇʲô£¬¿ÉÒԲο¼Ò»Ï¡£
Ïà¹ØÎĵµ£º
ÀûÓÃ
ÏÂÔصÄÕâ¶Î´úÂ룬³É¹¦ÊµÏÖÁËÊØ»¤½ø³Ì£¬ÔÀ´ÊØ»¤½ø³ÌÊǺܼòµ¥µÄÊÂÇé¡£
¡¡¡¡ÔÚmainº¯ÊýÖÐÖ´ÐÐ
¡¡¡¡init_daemon();//³õʼ»¯ÎªDaemon
¡¡¡¡¾Í¿ÉÒ԰ѽø³Ì±ä³ÉÊØ»¤½ø³Ì
¡¡¡¡
#include
#include
#include
#include
#include
void
init_daemon(void
)
{
int
pid;
int
i;
if
(pid=fork()) ......
Programming your application or library based on Qt has always had the promise that you can deploy your application on many different platforms. Development of those applications can, likewise, happen on many different platforms. QtCreator runs on Windows, Mac & Linux among others.
QtºÜ¼òµ¥£¬Ò× ......
×î½üÏëÔÚ·þÎñÆ÷ÉÏÊÔÊÔMySQL5.1µÄ·ÖÇø£¬ÓÚÊǾÍÏë×Å×°¸öMySQL5.1£¬¾¹ýÍ´¿àµÄÒ»¶Î¾Àúºó£¬ÖÕÓÚÕÒ¸öÏÂÃæ×°¸öºÜºÃµÄ½Ì³Ì£¬ÌûÉÏÀ´±¸Íü¡£
1¡¢MySQLÃâ°²×°°æ/¶þ½øÖÆ°æÈí¼þ£¬²»ÓñàÒ룬ÏÂÔصØÖ·£º
http://dev.mysql.com/downloads/
Îļþ¸ñʽ£ºMYSQL-VERSION-OS.tar.gz
2¡¢´ ......
¡¡¡¡Telnet·þÎñµÄÅäÖò½ÖèÈçÏÂ:
¡¡¡¡Ò»¡¢°²×°telnetÈí¼þ°ü(ͨ³£ÒªÁ½¸ö£©¡£
¡¡¡¡1¡¢ telnet-client (»ò telnet)£¬Õâ¸öÈí¼þ°üÌṩµÄÊÇ telnet ¿Í»§¶Ë³ÌÐò£»
¡¡¡¡2¡¢ÊÇ telnet-server Èí¼þ°ü£¬Õâ¸ö²ÅÊÇÕæÕýµÄ Telnet server Èí¼þ°ü£¡
¡¡¡¡°²×°Ö®Ç°Ïȼì²âÊÇ·ñÕâЩÈí¼þ°üÒÑ°²×°£¬·½·¨ÈçÏ£º
¡¡¡¡[root@wljs root]#rpm &ndas ......