Re: Bash native command to reverse the order of most basic parameter
From:
Greg Wooledge
Subject:
Re: Bash native command to reverse the order of most basic parameter
Date:
Tue, 26 Jul 2022 22:29:11 -0400
On Wed, Jul 27, 2022 at 08:50:05AM +0700, Budi wrote:
> How the Bash native command to reverse the order of native bash
> parameter loop illustrated:
> Code:
> $ foo 7 8 9
> 9
> 8
> 7
revparm() {
local i
for ((i=$#; i>=1; i--)); do
printf '%s\n' "${!i}"
done
}