15 lines
172 B
Bash
Executable File
15 lines
172 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
[[ $# != 1 ]] && echo "usage: $0 string" && exit 1
|
|
|
|
|
|
str=$1
|
|
len=${#str}
|
|
rev=""
|
|
|
|
for (( i=0; i<len; ++i ))
|
|
do
|
|
rev="${str:i:1}$rev"
|
|
done
|
|
echo "$rev"
|