You are not logged in.
Pages: 1
I hope this one qualifies as a programming question...
The thing is, I've finally managed to work around the garbled-screen-in-console-after-a-resume-from-sleep problem that I've had, albeit in a rather crippled way. I use vbetool restore to acomplish this, which works fine. I've noticed, though, that after a resume, I have to restore the vbestate every time I switch from X to console. That is, every time I switch, the screen is garbled and I have to restore the VBE. What I did was to trigger a bash script that restores the VBE whenever I press my power button.
Now, to the problem:
when I do this in X, X goes nuts and I have to restart it. For this reason I want a safety-net in my script that checks if the current VT is <7, in which case it restores the VBE; otherwise, I want it to do nothing at all. How do I do this? I know that the command 'fgconsole' gives the current VT, but how do I incorporate this in the if command?
Thanks in advance
Offline
something like:
vt=`fgconsole`
if [ $vt -ne 7 ]; then
vbetool
fi
or as a one-liner:
[ `fgconsole` -ne 7 ] && vbetool
Offline
ah! thanks. It was the '-ne'-thing I was looking for I guess. I've come over -f and -x in other peoples' scripts. Is there a list available anywhere? I've tried man if, but that's no good...
Offline
Is there a list available anywhere? I've tried man if, but that's no good...
It uses the "test" command internally - try "man test"
Offline
Great! Thanks a lot. That's precisely what I needed
Offline
That's documented (like all other bash internals) in "man bash", too.
dreaming in digital / living in realtime / thinking in binary / talking in ip / welcome to our world
Offline
man test
:shock: :shock: Son of a....
Offline
Pages: 1