Optional parameters: Difference between revisions

m
→‎{{header|Unix Shell}}: simplified output code
(Added Unix Shell (bash) implementation)
m (→‎{{header|Unix Shell}}: simplified output code)
Line 2,284:
{{works with|bash|4.2}}
<lang bash>#!/usr/bin/env bash
# sort-args.sh
 
data() {
Line 2,313:
}
 
printfecho "sort defaults\n" ; data | sort_table
printfecho "sort defaults reverse\n" ; data | sort_table reverse
printfecho "sort column 2\n" ; data | sort_table col 2
printfecho "sort column 2 reverse\n" ; data | sort_table col 2 reverse
printfecho "sort numeric\n" ; data | sort_table numeric
printfecho "sort numeric reverse\n" ; data | sort_table numeric reverse
</lang>
{{out}}
Anonymous user