📌  相关文章
📜  Shell 脚本中的反向字符串 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:29.445000             🧑  作者: Mango

代码示例1
#!/bin/bash
read -p "Enter string:" string
len=${#string}
for (( i=$len-1; i>=0; i-- ))
do
# "${string:$i:1}"extract single single character from string.
reverse="$reverse${string:$i:1}"
done
echo "$reverse"