Re: shell magic/info
Hello,
> They always start with that usual executable magic #!/bin/sh .
Actually, they can start with the full path to *any* program there.
> My concern is actually to write a program that will prompt a user 4 or 5
> inputs only, (pon, poff, elm, quit)
Check out "whiptail" (in the whiptail package, if memory serves).
> then make it as her default login shell,
chsh
> that way, i dont give her a fully interactive shell
Hmm, that's a bit harder - there's a lot of programs where you just press
`!' and there's a shell for you.
> (and a potential security hole for my feline friend).
If it's just felines you are worried about, then I guess that'll do :-)
> INXS: if not at all that busy, i really would like a template script, w/
> only 2 choices, a pointer on where/how do i start.
#!/bin/bash
while true; do
if whiptail --title "Luser Menu" --menu "Select" 20 60 10 \
elm "Read mail" \
"/usr/games/fortune;head -1" "Get a fortune cookie" \
2>tmp.$$
then
/bin/sh tmp.$$
rm tmp.$$
else
exit
fi
done
# How it works: "while true" loops forever. "if whiptail" runs the whiptail
# commands, with the switches given, redirecting 2=STDERR into tmp.$$ and,
# if the user picked OK, gives tmp.$$ to /bin/sh, otherwise it exits.
#
# The whiptail options: the three numbers are height, width and menuheight
# (you can adjust those); then follow pairs of "command" "Explanatory text"
# (with a backslash on the end of each line). Note in the "fortune cookie"
# entry, the "head -1" makes the computer wait for the user to press Enter.
#
# Make sure you have backslashes on the correct lines - they're important
HTH - Jiri <jiri@baum.com.au>
Reply to: