Logo 
Search:

Unix / Linux / Ubuntu Articles

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

Shell script to print first 5 odd numbers

Posted By: Binghamton Fischer     Category: Unix / Linux / Ubuntu     Views: 13922

Write a shell script to print first 5 odd numbers.

Code for Shell script to print first 5 odd numbers in Unix / Linux / Ubuntu

echo Enter a 5 digit number
read num
n=1
while [ $n -le 5 ]
do
a=`echo $num | cut -c $n`
echo $a 
n=`expr $n + 2`
done
  
Share: 


Didn't find what you were looking for? Find more on Shell script to print first 5 odd numbers Or get search suggestion and latest updates.

Binghamton Fischer
Binghamton Fischer author of Shell script to print first 5 odd numbers is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
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!