Skip to content

Commit

Permalink
more work on the array man page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ines Sombra committed Nov 10, 2011
1 parent 9368d71 commit 299c9bf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion bin/array/last
Expand Up @@ -18,6 +18,6 @@ array print my_array

# We can print out the last element of the array to standard out:
# one
array last "my_array"
array last my_array


41 changes: 28 additions & 13 deletions man/man1/array.1
Expand Up @@ -34,27 +34,42 @@ test if the array is nonempty
print the array elements separated by the separator string
.TP 13
.B largest {array2}
prints the largest (character count) element in the array
prints the largest (character count) element in a given array
.TP 13
.B last

prints the last element a given array
.TP 13
.B length

prints the element count of a given array
.TP 13
.B pop

removes the last element of a given array
.TP 13
.B push

.B shift


inserts an element at the end of an array
.TP 13
.B shift [placeholder variable] {origin}
shifts the first element off the array and prints to standard out if no placeholder variable is given
.TP 13
.B sort asc

Sort array elements in ascending order
.TP 13
.B sort desc

Sort array elements in descending order
.TP 13
B. start

Prints out the index of the first element of a given array. This allows you to get around shells indexing differently
Example:
a=(one two three)
a[0] # one in bash, nothing in zsh
a[1] # two in bash, one in zsh
a[$(array start)] # one
.TP 13
B. unique

B. unshift
Filter out all duplicated elements from a given array
.TP 13
B. unshift {origin} {item}
Appends an item to the beginning of a given array


.SH Options
Expand Down

0 comments on commit 299c9bf

Please sign in to comment.