Last active
March 20, 2018 09:40
-
-
Save mather/25a52227052951e49689a764645acd35 to your computer and use it in GitHub Desktop.
引数を反転させる関数(イマイチ)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
reverse () { | |
local COUNT | |
COUNT=$# | |
local PARAMS | |
PARAMS=("$@") | |
for i in $(seq $(($COUNT - 1)) 0) | |
do | |
echo ${PARAMS[${i}]} | |
done | |
} | |
AR=(1 2 3) | |
RES=($(reverse ${AR[@]})) | |
echo ${RES[@]} | |
# => 3 2 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
本当は
tac
が使いたい。