Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Question
In Linux, write a simple bash script that print the numbers from 1 to 4 out to the stdout in a loop (to demonstrate your knowledge of while loop).
Answer
#!/bin/bash
n=1
while [ $n -le 4 ]
do
​​​​​​​    echo $n
    n = $[n+1]
done
​​​​​​​

Question
In Linux, write a simple bash script that print the numbers from 1 to 4 out to the stdout in a loop (to demonstrate your knowledge of while loop).
Answer
?

Question
In Linux, write a simple bash script that print the numbers from 1 to 4 out to the stdout in a loop (to demonstrate your knowledge of while loop).
Answer
#!/bin/bash
n=1
while [ $n -le 4 ]
do
​​​​​​​    echo $n
    n = $[n+1]
done
​​​​​​​
If you want to change selection, open document below and click on "Move attachment"

7. Shell Scripting
ere is an example ( -le stands for less than or equal): 5 N=1 while test "$N" -le "10" do echo "Number $N" N=$[N+1] done The N=1 creates a variable called N and places the number 1 into it. The <span>while command executes all the commands between the do and the done repetitively until the test condition is no longer true (i.e., until N is greater than 10 ). The -le stands for less than o

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.