ѧϰlinux programming(1)
¡¾1. linux applications ÓÐÁ½ÖÖÐÎʽ¡¿
i£©¿ÉÖ´ÐеÄÎļþ£º ¿ÉÓɼÆËã»úÖ±½ÓÔËÐУ¬Ï൱ÓÚwindowsµÄ.exeÎļþ
ii£©Script: collections of instructions for another program. Ï൱ÓÚwindowsµÄ.bat .cmdÎļþ
¡¾2. PATH¡¿
ÔÚLinuxÖУ¬µ±ÊäÈë³ÌÐòÃû£¨ÈçFirefox£©Ê±£¬ÏµÍ³»áÔÚÃûΪPATHµÄShell±äÁ¿Ëù¸ø¶¨µÄһϵÁÐĿ¼ÖÐÑ°ÕÒÊÇ·ñÓÐͬÃûµÄÎļþ¡£
²é¿´PATHµÄÖµ£¬ÔÚLinux£º $PATH »òÕß echo $PATH
windows£º PATH
Linux¿ÉÖ´ÐÐÎļþλÖÃ˵Ã÷£º
/bin: binaries, programs used in booting the system
/usr/bin: user binaries, standard programs available to users
/usr/local/bin: local binaries, programs specific to an installation
µ±ÒÔadministatorÉí·Ý½øÈëʱ£¬¿ÉÄÜ»áʹÓÃϵͳ¹ÜÀí³ÌÐòËùÔÚµÄPATHĿ¼£¬Èç: /sbin »ò /usr/sbin
Linux£¬like unix, ÔÚPATH±äÁ¿µÄentriesÖ®¼äÓÃcolon(:)·Ö¸ô£¬¶øwindowsºÍms-dosÓÃsemicolon (;) ·Ö¸ô¡£
Linux£ºÊ¹ÓÃforward slash (/) À´·Ö¸ôĿ¼
eg: /usr/bin/
windows: ʹÓÃbackward slash (\)À´·Ö¸ô
eg: c:\Documents and settings\user>
¡¾3. C compiler¡¿
ÔÚPOSIX-compliant system (POSIX: Portable Operating System Interface), C compiler is called c89.
in linux, c89, cc, gcc refer to the system c compiler.
¡¾4. first c program in linux¡¿
1) hello.c file content
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello World!\n");
}
2) compile
$gcc -o hello hello.c
gcc²ÎÊý˵Ã÷£º
-o <file>£ºÊä³öµ½file,Èôδָ¶¨-o£¬ÔòdefaultÊä³öµ½a.out
Èç¹ûÒª²é¿´ÖмäÉú³ÉÎļþ£¬¿ÉÓÃgcc²ÎÊý -save-temps
$gcc -save-temps -o hello hello.c
$ls
hello hello.c hello.i hello.o hello.s
//ÒÔÉÏÉú³ÉµÄ4¸öÎļþ˵Ã÷¼û¡¾5.±àÒëϵͳ¡¿
3) execute
$./hello
˵Ã÷£º
ÈôÖ±½ÓÓÃhello£¬¼´Ö´ÐÐ
$hello
Ôòϵͳ»áÔÚShell±äÁ¿PATHËùÁгöµÄĿ¼ÖÐsearch£¬ÈôÇ¡ºÃÓÐÒ»¸öÃûΪ
helloµÄÎļþ£¬ÔòÖ´ÐÐÖ®¡£
./£º ´ú±íµ±Ç°Ä¿Â¼¡£
¡¾5.±àÒëϵÍ
Ïà¹ØÎĵµ£º
×¼±¸¹¤×÷:
¡¡¡¡Óõ½µÄperl À©Õ¹×é¼þ(modules)ÔÚÉÏƪÌù³ö.( win32::odbc Ä£¿é
)ÏÂÔØ×é¼þºó°´ÕÕReadmeÎļþ°²×°µ¹ÏìӦĿ¼.ÅäÖúÃÏàÓ¦µÄodbcÊý¾ÝÔ´.
¡¡¡¡
¡¡¡¡³ÌÐòʵÏÖ:
¡¡¡¡Ê¹ÓÃ
¡¡¡¡use
Win32::ODBC;
¡¡¡¡
¡¡¡¡Óï¾ä°üº¬Ó¦Ê¹ÓõÄÄ£¿éÊÇwin32::odbc,д³öÊý¾Ý¿â
Á¬½Ó×Ö·û´®
¡¡¡¡
¡¡¡¡$DSN = "DSN =
My DSN ......
ÔÚWindowsÖпÉÒÔÔÚijЩ·¾¶ÖвéÕÒÎļþ£¬Ò²¿ÉÒÔÉ趨²»ÔÚijЩ·¾¶ÖвéÕÒÎļþ£¬ÏÂÃæÓÃLinuxÖеÄfindµÄÃüÁî½áºÏÆä-path -prune²ÎÊýÀ´¿´¿´ÔÚLinuxÖÐÔõôʵÏִ˹¦ÄÜ¡£
¼ÙÈçÔÚµ±Ç°Ä¿Â¼Ï²éÕÒÎļþ£¬ÇÒµ±Ç°Ä¿Â¼ÏÂÓкܶàÎļþ¼°Ä¿Â¼£¨¶à²ãĿ¼£©£¬°üÀ¨dir0¡¢dir1ºÍdir2 ...µÈĿ¼¼°dir00¡¢dir01...dir10¡¢dir11...µÈ×ÓĿ¼¡£
......
LinuxÄÚºËÖÐÓÃÓÚͬ²½µÄ¼¸ÖÖ»úÖƼ¯ÖÐÆðÀ´·ÖÎö£¬Ç¿µ÷ÁËËüÃÇÖ®¼äÔÚʵÏÖºÍʹÓÃÉϵIJ»Í¬¡£
¡¡¡¡Í¬²½Í¨³£ÊÇΪÁË´ïµ½¶àÏß³ÌÐͬµÄÄ¿µÄ¶øÉè¼ÆµÄÒ»ÖÖ»úÖÆ£¬Í¨³£°üº¬Òì²½ÐźŻúÖƺͻ¥³â»úÖÆ×÷ΪÆäʵÏֵĵײ㡣ÔÚLinux 2.4ÄÚºËÖÐÒ²ÓÐÏàÓ¦µÄ¼¼ÊõʵÏÖ£¬°üÀ¨ÐźÅÁ¿¡¢×ÔÐýËø¡¢Ô×Ó²Ù×÷ºÍµÈ´ý¶ÓÁУ¬ÆäÖÐÔ×Ó²Ù×÷ºÍµÈ´ý¶ÓÁÐÓÖÊÇʵÏÖÐźÅÁ¿µÄ ......
£¨ÉùÃ÷£ºÕâÊÇתÔØ×Ôhttp://www.chinaunix.net/jh/21/1079.html)
´ÓSybaseµÄÕ¾µãÉÏÏÂÔØÁ½¸öÈí¼þ°ü£¬±ÊÕßÏÂÔØÁË11.0.3.3°æ±¾£¬SybaseÄ¿Ç°ÒѾÍƳöÁËASE11.9.2£¬ÓÉ
ÓÚ11.9.2Èí¼þ°üºÜ´ó£¬ÓÉ6¸örpmÈí¼þ°ü×é³É£¬¸÷λ¿ÉÒÔÈ¥ÆäÕ¾µãÏÂÔØ¡£¶ÔÓÚSybase¡¡11.0.3£¬sybaseÌṩÁË
Á½¸örpm¸ñʽµÄÈí¼þ°ü¡£
£¨ÕâÁ½¸öÎļþ¿ÉÒÔ¿´ÎÒ²©¿ ......
linuxÖеÄSHELLº¯ÊýÊÇ¿ÉÒÔ´ø²ÎÊýµÄ.
====´úÂë===
#!/bin/bash
function show()
{
echo $0 #·µ»Ø½Å±¾±¾ÉíÃû×Ö¶ø²»ÊǺ¯ÊýÃû
echo $1 #·µ»Øµ÷ÓÃʱµÄµÚÒ»¸ö²ÎÊý
.
.
.
echo $9   ......