上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 82 下一页
摘要: # command-line optionsfor Xdocase $X in 阅读全文
posted @ 2011-06-07 15:04 greencolor 阅读(210) 评论(0) 推荐(0) 编辑
摘要: set -x# activate debugging from herewset +x# stop debugging from herebash -x script1.sh 阅读全文
posted @ 2011-06-07 10:25 greencolor 阅读(86) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash# reassign-stdout.shLOGFILE=logfile.txtexec 6>&1 # Link file descriptor #6 with stdout. # Saves stdout.exec > $LOGFILE # stdout replaced with file "logfile.txt".# ----------------------------------------------------------- ## All output from commands in this block sent 阅读全文
posted @ 2011-06-05 21:40 greencolor 阅读(167) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash# Redirecting stdin using 'exec'.#exec 6<&0 # Link file descriptor #6 with stdin. # Saves stdin.exec 0< data-file # stdin replaced by file "data-file"read a1 # Reads first line of file "data-file".read a2 # Reads second line of file "data-file.&q 阅读全文
posted @ 2011-06-05 21:24 greencolor 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 1>filename # Redirect stdout to file "filename." 1>>filename # Redirect and append stdout to file "filename." 2>filename # Redirect stderr to file "filename." 2>>filename # Redirect and append stderr to file "filename." &>filename # Re 阅读全文
posted @ 2011-06-04 22:47 greencolor 阅读(203) 评论(0) 推荐(0) 编辑
摘要: n<&- Close input file descriptor n.0<&-, <&- Close stdin.n>&- Close output file descriptor n.1>&-, >&- Close stdout. 阅读全文
posted @ 2011-06-04 22:36 greencolor 阅读(132) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash# Declare arraydeclare -a ARRAY# Link filedescriptor 10 with stdinexec 10<&0# stdin replaced with a file supplied as a first argumentexec < $1let count=0while read LINE; do ARRAY[$count]=$LINE ((count++))doneecho Number of elements: ${#ARRAY[@]}# echo array's contentecho ${A 阅读全文
posted @ 2011-06-04 21:32 greencolor 阅读(198) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash#Declare array with 4 elementsARRAY=( 'Debian Linux' 'Redhat Linux' Ubuntu Linux )# get number of elements in the arrayELEMENTS=${#ARRAY[@]}# echo each element in array # for loopfor (( i=0;i<$ELEMENTS;i++)); do echo ${ARRAY[${i}]}done 阅读全文
posted @ 2011-06-04 21:09 greencolor 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 1) SIGHUP 本信号在用户终端连接(正常或非正常)结束时发出, 通常是在终端的控制进程结束时, 通知同一session内的各个作业, 这时它们与控制终端不再关联. 2) SIGINT 程序终止(interrupt)信号, 在用户键入INTR字符(通常是Ctrl-C)时发出 3) SIGQUIT 和SIGINT类似, 但由QUIT字符(通常是Ctrl-\)来控制. 进程在因收到SIGQUIT退出时会产生core文件, 在这个意义上类似于一个程序错误信号. 4) SIGILL 执行了非法指令. 通常是因为可执行文件本身出现错误, 或者试图执行数据段. 堆栈溢出时也有可能产生这个信号. 5). 阅读全文
posted @ 2011-06-04 21:06 greencolor 阅读(181) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bashecho -e "Hi, please type the word: \c "read wordecho "The word you entered is: $word"echo -e "Can you please enter two words? "read word1 word2echo "Here is your input: \"$word1\" \"$word2\""echo -e "How do you feel about ba 阅读全文
posted @ 2011-06-04 20:14 greencolor 阅读(123) 评论(0) 推荐(0) 编辑
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 82 下一页