• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Unix Question : Repeat commands, over and over?

Kenji4861

Banned
When I log into unix, I want it to keep showing me the latest log file on the screen... so I want the computer to keep typing

"tail -50 log_file" over and over.. say like every 3 seconds.

How can I do this?
 
Yep tail -f will do it.

Also for other commands you can set up a infinate loop in a bash shell. To break out of it you would hit ctl-c

while echo " "
do
ls -l ~
sleep 1
done

PS
For the while loop.... When you do something like "while command" or "if command" it will execute the loop based on the return value of the command. Each command returns a value when it comletes. To see the return value type "echo $?" immediately after the command is finished. A return of 0 will means that the command is succesfull. Other return values can indicate error codes. Since echo " " always works then the loop will go forever.
 
Back
Top