Re: shell magic/info
"Sibuyas Bombay" wrote:
>Hello everyone !
> I've been dirtying my hands on how interactive shell programs like smailco
>nfig,
>bindconfig (those who ask the user for a choice and execute something for th
>at
>choice).
> They always start with that usual executable magic #!/bin/sh . Does anyon
>e
>know of any documentation w/s can guide us how to write custom programs ? M
>y
>concern is actually to write a program that will prompt a user 4 or 5 inputs
>only, (pon, poff, elm, quit) then make it as her default login shell, that w
>ay,
>i dont give her a fully interactive shell (and a potential security hole for
>my feline friend).
> Thanks a lot in advance.
>Sib
>
>INXS: if not at all that busy, i really would like a template script, w/ onl
>y
>2 choices, a pointer on where/how do i start.
>
Make this script executable and make it the login shell (7th field of the line
in /etc/passwd); when it exits, the user will log out:
========================= begin =======================
#! /bin/sh
# Sample menu script
#
while true
do
echo -n "
Here are your choices -
1. Change your password
2. See today's date
3. Log off
Which do you want? "
x=
while [ -z "$x" ]
do
read x
done
echo
case $x in
1)
passwd
;;
2)
date
;;
3)
exit 0
;;
*)
echo -e "$x is a bad choice!\a"
;;
esac
done
========================== end ========================
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"For thou art my hope, O Lord GOD; thou art my trust
from my youth." Psalms 71:5
Reply to: