sorter.sc
来自「Advanced Bash− Scripting Guide An 」· SC 代码 · 共 21 行
SC
21 行
# Script is called sorter# It sorts numbers in ascending orderfunction sort ( scores, num_elements, temp, i, j ) { # temp, i, and j will be local and private, # with an initial value of null. for( i = 2; i <= num_elements ; ++i ) { for ( j = i; scores [j-1] > scores[j]; --j ){ temp = scores[j] scores[j] = scores[j-1] scores[j-1] = temp } }}{for ( i = 1; i <= NF; i++)grades[i]=$isort(grades, NF) #Two arguments are passedfor( j = 1; j <= NF; ++j )printf( "%d ", grades[j] )printf("\n")}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?