2011年6月11日

          [ -a FILE ] 如果 FILE 存在則為真。
          [ -b FILE ] 如果 FILE 存在且是一個塊特殊文件則為真。
          [ -c FILE ] 如果 FILE 存在且是一個字特殊文件則為真。
          [ -d FILE ] 如果 FILE 存在且是一個目錄則為真。
          [ -e FILE ] 如果 FILE 存在則為真。
          [ -f FILE ] 如果 FILE 存在且是一個普通文件則為真。
          [ -g FILE ] 如果 FILE 存在且已經設置了SGID則為真。
          [ -h FILE ] 如果 FILE 存在且是一個符號連接則為真。
          [ -k FILE ] 如果 FILE 存在且已經設置了粘制位則為真。
          [ -p FILE ] 如果 FILE 存在且是一個名字管道(F如果O)則為真。
          [ -r FILE ] 如果 FILE 存在且是可讀的則為真。
          [ -s FILE ] 如果 FILE 存在且大小不為0則為真。
          [ -t FD ] 如果文件描述符 FD 打開且指向一個終端則為真。
          [ -u FILE ] 如果 FILE 存在且設置了SUID (set user ID)則為真。
          [ -w FILE ] 如果 FILE 如果 FILE 存在且是可寫的則為真。
          [ -x FILE ] 如果 FILE 存在且是可執行的則為真。
          [ -O FILE ] 如果 FILE 存在且屬有效用戶ID則為真。
          [ -G FILE ] 如果 FILE 存在且屬有效用戶組則為真。
          [ -L FILE ] 如果 FILE 存在且是一個符號連接則為真。
          [ -N FILE ] 如果 FILE 存在 and has been mod如果ied since it was last read則為真。
          [ -S FILE ] 如果 FILE 存在且是一個套接字則為真。
          [ FILE1 -nt FILE2 ] 如果 FILE1 has been changed more recently than FILE2, or 如果 FILE1FILE2 does not則為真。 exists and
          [ FILE1 -ot FILE2 ] 如果 FILE1 比 FILE2 要老, 或者 FILE2 存在且 FILE1 不存在則為真。
          [ FILE1 -ef FILE2 ] 如果 FILE1 和 FILE2 指向相同的設備和節點號則為真。
          [ -o OPTIONNAME ] 如果 shell選項 “OPTIONNAME” 開啟則為真。
          [ -z STRING ] “STRING” 的長度為零則為真。
          [ -n STRING ] or [ STRING ] “STRING” 的長度為非零 non-zero則為真。
          [ STRING1 == STRING2 ] 如果2個字符串相同。 “=” may be used instead of “==” for strict POSIX compliance則為真。
          [ STRING1 != STRING2 ] 如果字符串不相等則為真。
          [ STRING1 < STRING2 ] 如果 “STRING1” sorts before “STRING2” lexicographically in the current locale則為真。
          [ STRING1 > STRING2 ] 如果 “STRING1” sorts after “STRING2” lexicographically in the current locale則為真。
          [ ARG1 OP ARG2 ] “OP” is one of -eq, -ne, -lt, -le, -gt or -ge. These arithmetic binary operators return true if “ARG1” is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to “ARG2”, respectively. “ARG1” and “ARG2” are integers.

          posted @ 2011-09-27 16:23 xsong 閱讀(1310) | 評論 (0)編輯 收藏

               摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->//源代碼class TT{       static int tt = 5;&nb...  閱讀全文

          posted @ 2011-09-23 13:55 xsong 閱讀(344) | 評論 (0)編輯 收藏

          #include <stdio.h>

          int main(int argc, char **argv) {

              
          /**
               * sizeof  關鍵字
               
          */
              
          int i=0;
              printf(
          "sizeof int %lu \n",sizeof(i)); // 4

              
          int *p=NULL;
              printf(
          "sizeof point %lu \n" ,sizeof(p) )    ; // 8
              printf("sizeof *p %lu \n",sizeof *p); // 4

              
          int a[100];
              printf(
          "sizeof array %lu \n"sizeof(a));// 100*4
              printf("sizeof a[100] %lu \n",sizeof(a[100])); // 4
              printf("sizeof &a %lu \n"sizeof(&a)); // 8  &a 是指針

              
          return 0;
          }

          posted @ 2011-09-16 15:04 xsong 閱讀(230) | 評論 (0)編輯 收藏

          #include <stdio.h>
          #include 
          <stdlib.h>
          #include 
          <event.h>
          #include 
          <evhttp.h>

          void generic_request_handler(struct evhttp_request *req, void *arg) {

              
          struct evbuffer *return_buffer=evbuffer_new();

              evbuffer_add_printf(return_buffer,
          "welcome");
              evhttp_send_reply(req,HTTP_OK,
          "Client",return_buffer    );
              evbuffer_free(return_buffer);
          }

          int main(int argc, char **argv) {
              
          short http_port =8082;
              
          char *http_addr="127.0.0.1";
              
          struct evhttp *http_serv=NULL;
              event_init();

              http_serv
          = evhttp_start(http_addr,http_port);
              evhttp_set_gencb(http_serv,generic_request_handler,NULL);
              event_dispatch();
              
          return 0;
          }

          posted @ 2011-08-05 14:51 xsong 閱讀(1355) | 評論 (0)編輯 收藏

          enum Action {Start, Stop, Rewind, Forward};

          // Special type of class 
          enum Status {
            Flunk(
          50), Pass(70), Excel(90);
            
          private final int value;
            Status(
          int value) { this.value = value; }
            
          public int value() { return value; } 
          };

          Action a 
          = Action.Stop;
          if (a != Action.Start)
            System.out.println(a);               
          // Prints "Stop"

          Status s 
          = Status.Pass;
          System.out.println(s.value());      
          // Prints "70"

          posted @ 2011-08-01 16:20 xsong 閱讀(220) | 評論 (0)編輯 收藏

          posted @ 2011-07-04 15:44 xsong 閱讀(299) | 評論 (0)編輯 收藏

          安裝  編輯 ~/.vimrc

          syntax on
          set tabstop=4
          set softtabstop=4
          set shiftwidth=4
          set autoindent
          set cindent
          set nu

          if &term=="xterm"
            set t_Co=8
            set t_Sb=^[[4%dm
            set t_Sf=^[[3%dm
          endif

          let g:neocomplcache_enable_at_startup = 1 


          "括號補全功能,

          :inoremap ( ()<ESC>i
                  :inoremap ) <c-r>=ClosePair(')')<CR>
          :inoremap { {}<ESC>i
              :inoremap } <c-r>=ClosePair('}')<CR>
              :inoremap [ []<ESC>i
              :inoremap ] <c-r>=ClosePair(']')<CR>
              :inoremap < <><ESC>i
              :inoremap > <c-r>=ClosePair('>')<CR>

              function ClosePair(char)
              if getline('.')[col('.') - 1] == a:char
              return "\<Right>"
              else
              return a:char
              endif
              endf

          posted @ 2011-06-11 12:58 xsong 閱讀(741) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 灵川县| 南木林县| 泰宁县| 教育| 中阳县| 泽州县| 紫云| 樟树市| 陇南市| 古田县| 德江县| 新巴尔虎左旗| 科技| 奈曼旗| 交城县| 延边| 勐海县| 江北区| 郓城县| 大悟县| 抚松县| 隆化县| 荥经县| 巨野县| 山东| 澎湖县| 荣成市| 扬中市| 镇坪县| 海安县| 新竹市| 资阳市| 莫力| 山阴县| 上饶市| 陆川县| 富平县| 班玛县| 原平市| 吉安市| 仙桃市|