Display number from 10 to 1 using shell programming in while loop


 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Display number from 10 to 1 using shell programming in while loop
# 1  
Old 08-04-2015
Display Display number from 10 to 1 using shell programming in while loop

echo "enter the number"
read n
while [ $n -ge 0 ]
do
echo "$n"
let n--
done

Last edited by aswin; 08-04-2015 at 12:39 PM.. Reason: show an error
# 2  
Old 08-04-2015
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run a shell script in a loop with max number of threads

hi guys. i have a question for you i have a one file and inside this file there are 1000 lines and each line is a linux command running this commands takes long time so i want to create one bash script and run this lines in a loop with max number of threads for example i want to run... (2 Replies)
Discussion started by: avtaritet
2 Replies

2. Shell Programming and Scripting

Display number from 10 to 1 using shell programming in while loop

display number from 10 to 1 using shell programming in while loop and using read n numbers (2 Replies)
Discussion started by: aswin
2 Replies

3. Shell Programming and Scripting

for loop iteration and shell programming startup

question :how can i iterate to next item in for loop with the loop e.g for i in `cat abc.txt` do echo $i // this will display first line i=$i+1; // this doesnt work for me. echo $i; //this will display secound line done question: is my approach to manipulate text good? I have... (3 Replies)
Discussion started by: kashif_islam
3 Replies

4. Shell Programming and Scripting

loop to display whatever number use types

sorry couldnt think of a proper title lol ok i have the following script it asks the user how many html tags they want. Im not sure how to display 2 tags if the user eneters the want only 2 tags tags as in <p></p> or <h1></h1> read -p "How many tags" tags1 if then echo "<$tags1>... (3 Replies)
Discussion started by: gangsta
3 Replies

5. Programming

Number of days in month from certain parameters, c programming request.

Hi, I have an issue in date processing, the issue is I have a month as an int ( 1 - 12 ), the weekday as int ( 0 - 6 , 0 = Sunday), and the week day in month as int ( 0 - 5, 5 = last ex: first sunday, last monday, third tuesday ... ), now from those three parameters is there a possible way to... (2 Replies)
Discussion started by: modn3
2 Replies

6. UNIX for Advanced & Expert Users

Kernel Programming: Finding the number of I/O requests

Hi I'd like to know a logic or a strategy to count the number of I/O requests that are being made. I have the PID of the process for which this needed to be done. Does anyone have any clue as to how to do this? This is to be done in Kernel programming in C. P.S: This is to be done in... (2 Replies)
Discussion started by: Ir1s
2 Replies

7. Shell Programming and Scripting

display unique number

Hi, how i can display all the unique number from my random number script below; #!/usr/bin/perl use strict; my @alphanum = ( 'A' .. 'Z', 'a' .. 'z', 0 .. 9); my $random = join('', map($alphanum,(1..5))); print "$random\n"; Thank You. (1 Reply)
Discussion started by: malaysoul
1 Replies

8. Solaris

Display Serial Number

Hello, I am running Solaris 9 and I need to display the serial number of my machine. How can I do this? Here is my machine info: SunOS birch 5.9 Generic_118558-09 sun4u sparc SUNW,Sun-Fire-V240 Thank you, David (5 Replies)
Discussion started by: dkranes
5 Replies

9. Shell Programming and Scripting

display number of subdirectories

Can anyone tell me what command would display the number of subdirectories in the current or given location? (2 Replies)
Discussion started by: jjamd64
2 Replies

10. Shell Programming and Scripting

obtaining a line number in ksh programming

Hi People, how do i obtain the line number of a ksh shell script that i am working on For example in C,when u key in __LINE__ will return u the current line number of the src code. regards wilson (1 Reply)
Discussion started by: wilsontan
1 Replies
Login or Register to Ask a Question