write a shell script to identify the given string is
palindrome or not?
Answer Posted / shashank gonte
#!/bin/sh
if [ $# -eq 1 ] #accept input through as parameter to #
command
then
echo $1 > temporary.txt #store input to a file
if [ `cat temporary.txt` = `rev temporary.txt` ]
then
echo -e "\n\n$1 is pelindrome\n\n"
else
echo -e "\n\n$1 is not pelindrome\n\n"
fi
rm temporary.txt #remove temporary created file
else #input validation for only one parameter accepted
echo -e "\n\ninvalid no of argument please enter
only one string argument\n\n"
exit 0
fi
| Is This Answer Correct ? | 0 Yes | 4 No |
Post New Answer View All Answers
What is sudo command?
Write a shell script that adds two numbers if provided as the command line argument and if the two numbers are not entered throws an error message.
What is the best shell scripting language?
What is awk script?
Write down the syntax for all the loops in shell scripting.
What are the different types of commonly used shells on a typical linux system?
Is bash an operating system?
What happens when you type ls?
What is another name for a bash shell script that you might see?
What is scripting used for?
Is shell and terminal the same?
What is shell scripting?
What are scripts in psychology?
c program which behaves like a shell(command interpreter). it has its own prompt say "NewShell$".any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command
Is shell script a programming language?