Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Write a shell script that accepts a string from the terminal and echo suitable message if it doesn’t have at least ten characters

Posted By: Bathilda Schmidt     Category: Unix / Linux / Ubuntu     Views: 7679

Write a shell script that accepts a string from the terminal and echo suitable message if it doesn’t have at least ten characters

Code for Write a shell script that accepts a string from the terminal and echo suitable message if it doesn’t have at least ten characters in Unix / Linux / Ubuntu

echo "Enter string"
read str

length=`echo $str | wc -c`
length=`echo $length - 1 |bc`
if [ $length -lt 10 ]
then
        echo "You enter less than 10 character"
fi
 
  
Share: 



Bathilda Schmidt
Bathilda Schmidt author of Write a shell script that accepts a string from the terminal and echo suitable message if it doesn’t have at least ten characters is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!