Tekkaman

导航

 

2013年12月6日

摘要: [define中的:#,##,#@]#defineConn(x,y)x##y#defineToChar(x)#@x#defineToString(x)#x(2)x##y表示什么?表示x连接y,让compiler认为 xy 需要组合在一起, 被看作是一个符号而不是其它. 举例说:intn=Conn(123,456);/* 结果就是n=123456;*/char*str=Conn("asdf","adf");/*结果就是 str = "asdfadf";*/(2)再来看#@x,其实就是给x加上单引号,结果返回是一个const char。举 阅读全文
posted @ 2013-12-06 14:16 Tekkaman 阅读(550) 评论(0) 推荐(0)
 
摘要: 【shell-array】Creating Array:1 $ names=("Bob" "Peter" "$USER" "Big Bad John")2 $ names=([0]="Bob" [1]="Peter" [20]="$USER" [21]="Big Bad John")3 # or...4 $ names[0]="Bob"You can get the number of elements of an 阅读全文
posted @ 2013-12-06 14:11 Tekkaman 阅读(317) 评论(0) 推荐(0)
 
摘要: [bash's parameter expansion] #: find first from left, remove-left ##: find last from left, remove left %: find first from right, remove right %%: find last from right, remove right example 1:1 parameter result2 ----------- ------------------------------3 ${NAME} polish.ostrich.racing.cha... 阅读全文
posted @ 2013-12-06 14:05 Tekkaman 阅读(303) 评论(0) 推荐(0)