answersLogoWhite

0


Best Answer

UNIX as such is only the operating system.

You would need an application, either written in a high level language, eg C and compiles into a binary that would execute, or you could use a series of commands (a shell script - a "program" for the shell with which you normally interact), which could be csh, bash, tcsh, zsh, etc - each shell having its own script language.

As an example you could use either of the following:

$ cat > num1-100.c
#include
main ()
{
int i;
for (i = 0; i++ < 100; ) printf("%d, ", i);
printf("\n");
return 0;
}
^D
$ cc num1-100.c
$ ./a.out
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
$

or a bash [command] script:

$ let c=0 ; while [ $c -lt 100 ]; do let c=$c+1; echo -n "$c, "; done ; echo
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
$

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you print numbers 1 to 100 in UNIX. Is it echo '1-100'?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a unix program to print print a pattern?

echo 'print a pattern'


Program to print the greatest number in unix?

There is no such thing as 'the greatest number'. Here is a program in unix to prove it: echo 'for (i=1; i&gt;=0; i= i*2) print i,"\n";' | bc if you want to actually see the output use it this way: echo 'for (i=1; i&gt;=0; i= i*2) print i,"\n";' | bc | less -S


What is the difference between echo and printf command of UNIX?

Echo merely repeats its command line arguments as stated. The 'printf' command allows for formatted print and a more exacting method of printing out information. Printf requires you to specify the format of what you want to print; echo does not have this ability.


Unix program for adding of two numbers?

$vi sum.sh echo "enter the 1st no." read num1 echo "enter the 2nd no." read num2 sum= 'expr $num1 + $num2' echo "sum of the numbers is $sum"


Write a program to calculate the sum of two numbers in unix?

$vi sum.sh echo "enter the 1st no." read num1 echo "enter the 2nd no." read num2 sum= 'expr $num1 + $num2' echo "sum of the numbers is $sum"


Program for finding the greatest of three numbers in unix?

echo "enter the 3 numbers" read a b c if [ $a -gt $b ]&amp;&amp;[ $a -gt $c ] then echo "$a is big" elif [ $b -gt $c] then echo "$b is big" else echo "$c is big" fi


How do you print a number as on or more literal words in PHP?

Create an array like so $numbers = array(); $numbers['0'] = "ZERO"; $numbers['1'] = "ONE"; and so on.. till you decide that's enough then to print it, echo the array with the desired key like so.. Example I print 5 in words echo $numbers['5']; which would print FIVE Good luck


Write a unix shell program to print the prime numbers?

i=2 rem=1 echo "Enter a number" read num if [ $num -lt 2 ] then echo "$num is not prime" exit 0 fi while [ $i -le `expr $num / 2` -a $rem -ne 0 ] do rem=`expr $num % $i` i=`expr $i + 1` done if [ $rem -ne 0 ] then echo "$num is prime" else echo "$num is not prime" fi


What is difference between echo and ' ' in unix?

Echo is a program. '' is not a program. '' does not perform any action. Echo returns what you type. '' does not.


In unix echo prints?

Echo repeats whatever you put on the command line.echo This is a testwill echo to the screen:This is a test


How do you redirect a displayed line used by echo command to a file in UNIX?

echo "This is my text" &gt; myfile.txt


What is a regular expression in PHP?

echo or print &lt; both of which write text: &lt;?php echo "TEXT"; print "TEXT"; ?&gt;