
Alrighty got it sorted, had to poke the syntax used in the if statement a bit. Was going for a password protect kind of setup used along with what's in the last post. That being when someone is following one of the tutes on autologin/startx(on tty1)without a display manager. Noted that I fiddled with things a bit, so it's just autologin without a display manager and using a script run on user login to prompt whether or not to start a graphical session. This is an example using a password protected prompt instead.
- Code: Select all
#!/bin/bash
echo
echo
read -sn5 -p " Enter access code or pass-phrase. " XORG
if [ $XORG -eq 12345 ]; then
[ "$(tty)" = "/dev/tty1" ] && exec startx
else
echo " Let's see some ID !! WHO ARE YOU, WHERE DO YOU COME FROM ... WHAT DO YOU WANT TO DO WITH YOUR LIFE ?!?! "
fi
echo
echo
Quick explanation of that stuff. the -s is for silent so what someone types on the prompt isn't visible to whoever may be watching you, the n5 just means that bash reads the first 5 characters typed and stores them in a variable named XORG, IF what a user enters matches ( is equal/-eq to 12345, my super-secret password example here)the value of the XORG variable in the if statement, then it runs the following line starting the graphical session. Though if what the person enters doesn't match, is not -eq to 12345, runs the other command, echo's "Let's see some ID etc."
Yeppers that could be a lot of other things folks. Use your imagination ... that's what it's for.
