linux Òþʽµ÷Óà ×Ô¼ºÐ´µÄ¶¯Ì¬¿â
~/test
|
|
|------main.c
|------lib
| |
| |------StringLen.h
| |------Strlen.c
| |------Strnlen.c
----------------StringLen.h:
#ifndef _STRINGLEN_H__
#define _STRINGLEN_H__
int Strlen(char *pStr);
int StrNlen(char *pStr, unsigned long ulMaxLen);
#endif
-------------------------------------------------
---------------Strlen.c:
#include<stdio.h>
#include<assert.h>
#include "StringLen.h"
int Strlen(char *pStr)
{
unsigned long ulLength;
assert(NULL != pStr);
ulLength = 0;
while(*pStr++)
{
ulLength++;
}
return ulLength;
}
-------------------------------------------------
---------------Strnlen.c:
#include<stdio.h>
#include<assert.h>
#include "StringLen.h"
int StrNlen(char *pStr, unsigned long ulMaxLen)
{
unsigned long ulLength;
assert(NULL != pStr);
if(ulMaxLen <= 0)
{
printf("Wrong Max Length!\n");
return -1;
} &
Ïà¹ØÎĵµ£º
°²×°£¬Éý¼¶ºÍжÔØÓ¦ÓÃÈí¼þÊÇÓ°ÏìÓû§¶Ô²Ù×÷ϵͳÆÀ¼ÛµÄ¾ö¶¨ÐÔÒòËØÖ®Ò»¡£¶ÔÓÚÈÕ½¥Á÷ÐÐµÄ GNU/Linux ²Ù×÷ϵͳ£¬ÓµÓмò½àÇ¿´óµÄÈí¼þ°ü¹ÜÀí»úÖƹ¦²»¿Éû¡£±¾ÎÄ´Ó»ù±¾µÄ rpm/dpkg ÃüÁîÐгö·¢£¬ÒÔ RHEL ºÍ UBUNTU ΪÀý£¬½éÉܵäÐÍ Linux ϵͳÖÐÓ¦ÓÃÈí¼þµÄ¹ÜÀíºÍʹÓá£
RPM/DPKG Á½´óÕóÓª¼ò½é
ÔÚ GNU/Linux( ÒÔϼò³Æ Linux) ²Ù×÷Ï ......
Ò»¡¢Ê²Ã´ÊÇinit
¡¡¡¡initÊÇLinuxϵͳ²Ù×÷Öв»¿ÉȱÉٵijÌÐòÖ®Ò»¡£ ÊÇÒ»¸öÓÉÄÚºËÆô¶¯µÄÓû§¼¶½ø³Ì¡£
¡¡¡¡ÄÚºËÆô¶¯£¨ÒѾ±»ÔØÈëÄڴ棬¿ªÊ¼ÔËÐУ¬²¢Òѳõʼ»¯ËùÓеÄÉ豸Çý¶¯³ÌÐòºÍÊý¾Ý½á¹¹µÈ£©Ö®ºó£¬¾Íͨ¹ýÆô¶¯Ò»¸öÓû§¼¶³ÌÐòinitµÄ·½Ê½À´Æô¶¯ÆäËûÓû§¼¶µÄ½ø³Ì»ò·þÎñ¡£ËùÒÔ£¬initʼÖÕÊǵÚÒ»¸ö½ø³Ì£¨ÆäPIDʼÖÕΪ1£©¡£
¡¡¡¡ÄÚºË ......
½Ó´¥LinuxÒ²ÊǺܾõÄÊÂÇéÁË£¬²»¹ý×ÔÎҸоõÈ´´ÓÀ´Ã»Óнҿª¹ýËüµÄÕæÃæÉ´¡£´ÓÎÒ¹¤×÷ÒÔÀ´µ½ÏÖÔÚ£¬¼¸ºõ×Ü»áÓõ½linux»òÔÚlinuxϵͳÉϽøÐй¤×÷£¬Ò²Ò»Ö±Ïë°Ñlinux¸ã¶®¡£µ«ÊÇ£¬ÓÉÓÚ×ܸоõLinuxµÄÅÓ´ó£¬Ó¢ÎÄ×ÊÁÏÄÑÒÔÔĶÁ£¬¼ÓÉÏ×ÔÉí·Ç³£µÄÀÁÉ¢£¬Òò´Ë¼¸´Î϶¨¾öÐÄ£¬×îÖÕ»¹ÊDz»ÁËÁËÖ®°É¡£ ......
LinuxÏÂÈí¼þ¡¢PHPºÍPerlµÄÄ£¿éµÈ¶¼ÊµÏÖÁË×Ô¶¯°²×°£¬ÕæµÄºÜ·½±ã£¬±¾Îļòµ¥½éÉÜһϡ£
linuxÏ¿ÉÒÔʹÓÃyum¹¤¾ß£¬RedhatÏÂ×Ô¶¯´øÓУº
yum list php* //¿ÉÒԲ鿴phpµÄÏà¹ØÄ£¿é
yum install php //°²×°phpÕâ¸öÄ£¿é
phpÄ£¿éµÄ×Ô¶¯°²×°(ÀûÓÃpecl.php.netºÍpear.php.netÔÚÏß°²×°)£º
ÀûÓÃpearºÍpecl¹¤¾ß£¬Ê×ÏÈÐèÒª° ......
st='abcd'
1.×Ö·û´®³¤¶È
expr length $st »òÕß ${#st}
2.È¡×Ö·û´®µÄsubstring
expr substr "$var" startpos length »òÕß ${var:m} ${var:m:len}
${var:m}ÖеÄmµÄÈ¡Öµ´Ó0µ½${#var}-1£¬Æä·µ»ØµÄÊÇ´ÓµÚm¸ö×Ö·ûµ½×îºóµÄ²¿·Ö£»ÀýÈçecho ${st:1}µÄ½á¹ûÊÇ'bcd'
expr substr "$var" startpos length ÖеÄstartposÈ¡Öµ·¶Î§ÊÇ ......