[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A simple screensaver that works - any improvement possible?



On 27/03/2021 16:06, Susmita/Rajib wrote:
> The working code, here:
> [?]invoke a screensaver and xset through script
> Link:
> http://forums.debian.net/viewtopic.php?f=8&t=149128
> Not posting the code here, as it would be a case of repitition.
> Best.
> Rajib
>
OK. You're wanting something that turns the screen off while idling at
the console? Are you aware of physlock and vlock?

You've assigned the value 0 to the variable $done, and then not
referenced it - remove that assignment.

You initialise $i and increment it, but then you don't actually use it
anywhere?

Instead of "kill -18" and "kill -19", use "kill -CONT" and "kill -STOP"
- it's more readable.

Don't use backticks, use $(...) instead, as it nests better.

Your usage states to run "./ssvr.sh ssvr.sh" and then you use "kill ...
`pidof $1`". This seems to imply that you're not aware of the $$
variable, which is the PID of the current shell.

Most of these are simple fixes which shellcheck.net can advise you on.
If possible, you should find a plugin for the editor you're using which
can give you realtime shellcheck advice :)


Attachment: OpenPGP_signature
Description: OpenPGP digital signature


Reply to: