Author Topic: Oldschool Cli  (Read 1688 times)

vrejakti

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://www.animecharactersdatabase.com
Oldschool Cli
« on: June 17, 2007, 04:05:59 pm »
Anyone remember the days of telnet BBS's? I had the idea a while back that installing a BBS on my Zaurus would restore my interest in my Z. Strangely, they are hard to come by now. I did however find a BBS called iBBS which is written entirely in Bash. This peaked my interest, and lead me to start a new project.

The project is a simple shell for the Zaurus. This is a frame work, not an actual application you should use. You must modify and expand the code to suit your needs. Anything is possible with this framework, given enough creativity.


Code: [Select]
#!/bin/bash
FP="/home/fenrir/forums"
viewing="0"
export path=""


function viewthread()
{
while true
do
echo
for i in `ls $FP/$viewing/[0-9] 2>/dev/null`
do
echo "----=[ `basename $i` ]=-------------------------"
head -n 2 $i
echo "------------------------------------"
echo
done

printf "[vBBS-thread] "
read n
if [ -z $n ]
then
return
fi

if [ -a $FP/$viewing/$n ]
then
less $FP/$viewing/$n
fi
done
return
}

function viewforums()
{
while true
do
echo "----=[ FORUMS ]=--------------------"
for i in `ls $FP 2>/dev/null`
do

echo $i. `cat $FP/$i/title`

done
echo "------------------------------------"

printf "[vBBS-forums] "

read n
if [ -z $n ]
then
return
fi

if [ -a "$FP/$n" ]
then
viewing="$n"
viewthread
fi
done
return
}

function reply()
{
nano $path
}






function menu()
{
printf "
[h]   Show this help
[c]  Launch music player
[q]   Quit this Application
[s]  Put Zaurus to sleep
[e]   Launch nano editor
[o] Go online
[w]  Launch web prowser
[a]   Mount swap
[t]  View threads

"
}



while true
do
printf "[vBBS] "
read c
case "$c" in
[qQ]  ) exit;;
[hH] ) menu;;
[sS] ) echo "Goign to sleep. See you soon!"; apm -s;;
[cC] ) cplay;;
[nN] ) nano;;
[lL] ) links;;
[tTrR] ) viewforums;;
*  );;
esac
done

I find there to be something nice about having a menu driven shell on the Zaurus. If you like it to, feel free to expand that script to simplify the applications you use.