Harihara
Harihara

Reputation: 2737

Bash script to check if screen lock is enabled

I am a novice at shell scripting. I want to store the result of whether screen lock is enabled or not. Here's my script (with something wrong in it):

now=$(gsettings set org.gnome.desktop.lockdown disable-lock-screen 'false')

When I echo, I get no value stored in the variable now.

echo $now

(gives nothing)

Upvotes: 1

Views: 2167

Answers (1)

0xc0de
0xc0de

Reputation: 8287

In your command, you are not reading, you are setting :)

try this:

now=$(gsettings get org.gnome.desktop.lockdown disable-lock-screen)

I am not sure why are you checking the result of setting the value. Is it a mistake or you intend to do it?

Upvotes: 8

Related Questions