#
str.sh
# Program : To accept a
string and display as shown in the following example, suppose str = “RAJESH”
|
|
|
|
|
R
|
|
|
|
|
R
|
A
|
|
|
|
R
|
A
|
J
|
|
|
R
|
A
|
J
|
E
|
|
R
|
A
|
J
|
E
|
S
|
R
|
A
|
J
|
E
|
S
|
H
|
# Author : sujith
# Date : 17/03/2015
echo
"Enter the word to print"
read str
len=$(echo
"$str" | wc -c)
a=`expr
$len \* 2 - 2`
len=`expr
$len - 1`
echo
"len=$len"
i=1
while [
$i -le $len ]
do
b=1
while [ $b -le $a ]
do
echo -n " "
b=`expr $b + 1`
done
a=`expr $a - 2`
l=1
while [ $l -le $i ]
do
ch=$(echo "$str" |
cut -c$l)
echo -n " $ch"
l=`expr $l + 1`
done
echo " "
i=`expr $i + 1`
done
Output:
[141740@localhost
~]$ sh str.sh
Enter the
word to print
RAJESH
len=6
|
|
|
|
|
R
|
|
|
|
|
R
|
A
|
|
|
|
R
|
A
|
J
|
|
|
R
|
A
|
J
|
E
|
|
R
|
A
|
J
|
E
|
S
|
R
|
A
|
J
|
E
|
S
|
H
|
[141740@localhost
~]$
Hard Rock Casino, Henderson - MapyRO
ReplyDeleteHard Rock Casino, Henderson, NV, 서울특별 출장샵 USA. 0. 5.3 강원도 출장안마 mi (1.0 km) 5 Casino Drive. 5.3 mi (1.0 km) 5 양산 출장마사지 Casino Drive. 5.3 mi (1.0 km) 5 Casino Drive. 5.3 mi 포천 출장샵 (1.0 김해 출장샵 km) 5 Casino Drive