Question Locked

Help required in Shell Script

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Shell script
1.how to generate the following series ,1,3,2,4,3,5,4,6......100

2.how to write a shell script to check if a given string is palindrome or not (without reversing the string)

3.how to write a shell script to display the following pattern using while loop.
1
22
333
4444

3 replies

by maheshkarnekar

Hello Sir,

I want the Code of Shell Script Code to check whether the entered string is palindrome or not.

by sweety_17

how to write a shell script to display the following pattern using while loop.
1
22
333
4444

ANS:: I have tried. but i dunno whether is it right or not. check it!!!

i=1
while((i-le 5))
do
j=1
while((j -le i))
do
echo -n "$i"
j++
done
echo " "
i++
done

output:
-------
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

This discussion is closed to new replies.