Publié le 01/06/2006 à 21:09
Par Danyel
CHANGE | DELETE | MOVE | INSERT | OTHER |
cw word cc line C rest of line s under cursor S same as cc r replace char | dw word dd line D rest of line x under cursor X before cursor xp transpose | k line up j line down l right space h left space 0 beginning of line $ end of line w word forward b word backward e end of word G end of file ^D scroll down | a after cursor A at end of line i before cursor I at the begi9n of line o open line below O open line above yw yank word yy yank line p put | u undo change
. repeat
/ find down
? find up
n next |
| SAVE/QUIT | ex COMMANDS | STATES |
:w write buffer :q quit :wq write & quit :q! abandon buffer ZZ same as :wq ^Z suspend vi | :se nu set numbers :se nonum no numbers :r file read in file :!cmd run cmd :se wm 10 wrap words | command: initial state cancel partial command with ESC
insert: enter with alocs, ALOCS end with ESC
last line: enter with : / ? end with RET |
Publié le 01/06/2006 à 20:02
Par Danyel
###################################################################
# #
# Simple Menu Shell Script #
# #
###################################################################
# A very simple menu
# The main logic for the program displays the menu
# gets the users entry and initiates the activity
#
#******************************************************
# MAIN LOGIC
#******************************************************
# Repeat the menu over and over
# Steps are:
# 1. Display the menu
# 2. 'read' a line of input from the key board
# 3. Check the answer for 1, 2, 3 or 0 and dispatch
# to the appropriate function or exit
# 4 Repeat until 0 is entered
while true
do
# 1. display the menu
echo "\t\t\t\t Menu: \c"
logname
echo "\t\t\t\c"
date
echo "------------------------------------------------------------------------------ "
echo "| 1- List directory 17- Calendar 33-HOME |"
echo "| 2- List directory short 18- List ASCII character 34-CHGROUP DE |"
echo "| 3- 19- 35-CHGROUP UK |"
echo "| 4- 20- 36-CHGROUP SOURCE |"
echo "| 5- 21- 37-CHGROUP SUBS |"
echo "| 6- 22- 38-CHGROUP COPYLIB |"
echo "| 7- 23- 39-CHGROUP MAKE |"
echo "| 8- 24- 40-CHGROUP CODE |"
echo "| 9- 25- 41-CHGROUP PUB |"
echo "|10- 26- 42-CHGROUP ?????? |"
echo "|11- 27- 43-Up one level |"
echo "|12- 38- 44-Down one level |"
echo "|13- 29- 45- |"
echo "|14- 30- 46- |"
echo "|15- 31- Qedit 47- |"
echo "|16- Ver.prog cbl> 80car. 32- Vi 48-MPE |"
echo "------------------------------------------------------------------------------ "
echo "Path: $PWD "
echo "------------------------------------------------------------------------------ "
echo "Select by pressing a number and then ENTER (0. Exit)"
# 2. read a line of input from the keyboard
read answer
# 3. Execute commands based on the
# number entered by the user.
case $answer in
1) ll
echo
echo
echo "Directory Listing now complete * Press Enter"
read x ;;
2) ls
echo
echo
echo "Directory Listing now complete * Press Enter"
read x ;;
16) maxcbl
echo
echo
echo "Verification is now complete * Press Enter"
read x ;;
17) echo "Month= \c"
read parm1
echo "Year= \c"
read parm2
echo
echo
echo
echo
if ! test -n "$parm1"
then
if ! test -n "$parm2"
then
parm1=`date "+%m"`
fi
fi
if ! test -n "$parm2"
then
parm2=`date "+%Y"`
fi
cal $parm1 $parm2
echo
echo
echo echo "Show Calendar now complete * Press Enter"
read x ;;
18) echo
cat /users/pso/danielve/ascii
echo
echo echo "List is now complete * Press Enter"
read x ;;
31) qedit ;;
32) vi;;
9) count=20
until [ $count -lt 0 ]
do
echo "* \r \c "
sleep 1
echo "\ \r \c "
sleep 1
echo "* \r \c "
sleep 1
echo "/ \r \c "
sleep 1
count=`expr $count - 1`
done;;
33) cd;;
34) z1=`pwd`
z2=`expr index $z1 "UK"`
z2=`expr $z2 - 1`
z3=`expr substr $z1 1 $z2`
z2=`expr $z2 + 3`
z4=`expr substr $z1 $z2 50`
z5=$z3"DE"$z4
cd $z5;;
35) z1=`pwd`
z2=`expr index $z1 "DE"`
z2=`expr $z2 - 1`
z3=`expr substr $z1 1 $z2`
z2=`expr $z2 + 3`
z4=`expr substr $z1 $z2 50`
z5=$z3"UK"$z4
cd $z5;;
36) z1=`pwd`
z2=`dirname $z1`
cd $z2"/SOURCE";;
37) z1=`pwd`
z2=`dirname $z1`
cd $z2"/SUBS";;
38) z1=`pwd`
z2=`dirname $z1`
cd $z2"/COPYLIB";;
39) z1=`pwd`
z2=`dirname $z1`
cd $z2"/MAKE";;
40) z1=`pwd`
z2=`dirname $z1`
cd $z2"/CODE";;
41) z1=`pwd`
z2=`dirname $z1`
cd $z2"/PUB";;
42) z1=`pwd`
z2=`dirname $z1`
echo "GROUPE= \c"
read parm1
cd $z2"/"$parm1;;
43) cd ..;;
44) line=0
count=0
find ./* -prune -type d >/users/pso/danielve/test
while [ $count = 0 ]
do
line=`expr $line + 1`
commande=$line\s/\./$line\./p
result=`sed -n $commande /users/pso/danielve/test`
echo $result
if ! test -n "$result"
then
count=`expr $count + 1`
fi
done
echo "Directory Number = \c"
read parm1
if test -n "$parm1"
then
commande1=$parm1\p
cd `sed -n $commande1 /users/pso/danielve/test`
fi;;
48) cd /users/pso/QVC/support
. MPE Y;;
49) . ISS;;
0) break ;;
esac
# Do it again until the user enters 0.
done