Reputation: 75
String sorting algorithm in shell script.
I have done it for numbers,but not able to do for string.
EX:- I am kohali. It should be like am i kohali
Upvotes: 0
Views: 6892
Reputation: 3914
Below script will help you
str='I am kohali'
for i in `echo $str`; do
echo $i
done | sort
Below one will accept input from user
read -p "Enter your string:" str
for i in `echo $str`; do
echo "$i"
done | sort
Output
am I kohali
Upvotes: 2