LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Old

Ugly script to sleep "accordingly" to CPU temperature, on loops

Posted 03-28-2014 at 08:40 PM by the dsc (linux-related notes)

Sometimes you have a script or one-liner loop thing that may put quite a heavy load on the CPU, that can be at least bothersome due to the noise of the fan, or somewhat worrisome if the temperature approaches or goes beyond what the processor specifications recommend, and yet the system doesn't do anything by itself to avoid it.

One could simply add some arbitrary, constant sleep time within the loop, but that will likely make the whole thing slower than it needs to be. If within...
Member
Posted in Uncategorized
Views 1418 Comments 0 the dsc is offline
Old

Bash quickie: loop N times, without doing math

Posted 10-22-2012 at 09:07 PM by the dsc (linux-related notes)
Updated 03-10-2013 at 12:25 AM by the dsc (improving, varible version)
Tags bash, loop

I thought that the only way to do such type of loop in Bash would require something like "n=$(($n+1))" within the loop, with the loop being conditioned to "n" adding up to whatever you want, such as "until ((n==30)) ; do". But you can actually do "for i in {1..20} ; do <whatever> ; done". That's somewhat similar to Basic's "for i=1 to 20 ; whatever ; next i".

But it won't work with variables for the starting and ending numbers....
Member
Posted in Uncategorized
Views 1702 Comments 0 the dsc is offline

  



All times are GMT -5. The time now is 08:39 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration