Sample Header Ad - 728x90

Bash - reverse an array

38 votes
15 answers
50619 views
Is there a simple way to reverse an array? #!/bin/bash array=(1 2 3 4 5 6 7) echo "${array[@]}" so I would get: 7 6 5 4 3 2 1 instead of: 1 2 3 4 5 6 7
Asked by nath (6094 rep)
Dec 25, 2017, 12:53 AM
Last activity: Dec 24, 2024, 07:05 PM