Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

reverse string in shell script

#!/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"
Source by technicalworldforyou.blogspot.com #
 
PREVIOUS NEXT
Tagged: #reverse #string #shell #script
ADD COMMENT
Topic
Name
7+6 =