![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
PFO Founder
![]() ![]() |
here is my menu script i wrote awhile back. i know its pretty boring but im bored and thought i should post something in here finally
![]() menu #bin/sh
cd
clear
menu.awk
while :
do
read INPUT_STRING
case $INPUT_STRING in
1)
echo "Enter the name or ip of computer you want to connect to."
read ssh_string
echo "Enter your user name for this machine."
read user_string
ssh -l $user_string $ssh_string
clear
menu.awk
;;
2)
clear
mc
clear
menu.awk
;;
3)
clear
echo "Option 3 is Unused"; echo
menu.awk
;;
4)
echo "Enter File to change permissions of."
read file_perm
echo "Enter permissions you want to use, using the number system."
read perm
chmod $perm $file_perm
clear
echo "File permissions have been changed."; echo
menu.awk
;;
5)
echo "Enter Directory to change permisions of."
read dir_perm
echo "Enter permissions you want to use, using the number system."
read perm2
chmod -R $perm2 $dir_perm
clear
echo "Directory permissions have been changed."; echo
menu.awk
;;
6)
clear
ls -la | less
echo
menu.awk
;;
7)
echo "Enter the Directory you want to move to."
read dir
cd $dir
clear
menu.awk
;;
8)
clear
echo "Enter File you want to edit"
read file
vim $file
clear
menu.awk
;;
9)
clear
echo "Option 9 is Unused"; echo
menu.awk
;;
10)
clear
echo "Option 10 is Unused"; echo
menu.awk
;;
clear)
clear
menu.awk
;;
//)
echo "Exiting!"
break
;;
*)
echo "Sorry, I don't understand"
;;
esac
donemenu.awk awk 'BEGIN { menu="************** MENU ****************\n"
menu=menu "* 1) SSH To Remote Computer *\n"
menu=menu "* 2) Midnight Commander *\n"
menu=menu "* (Command line file manager) *\n"
menu=menu "* 3) *\n"
menu=menu "* 4) Change File Permissions *\n"
menu=menu "* 5) Change Dir Permissions *\n"
menu=menu "* 6) List Files in Directory *\n"
menu=menu "* 7) Change Directory *\n"
menu=menu "* 8) Edit File in Direcotry *\n"
menu=menu "* 9) *\n"
menu=menu "* 10) *\n"
menu=menu "* *\n"
menu=menu "* clear) Clear Screen *\n"
menu=menu "* //) Quit to Prompt *\n"
menu=menu "************************************\n"
menu=menu "\n"
menu=menu "Enter Your Selection: "
print menu }'if you put both of these files in your /usr/bin/ dir you can just run the thing by typing menu anywhere you are ![]()
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Now there's an idea... if anyone wants my JavaScript/PHP/XML menu generator, let me know. Nice code, K.
|
|
|
|
|
|
#3 |
|
PFO Founder
![]() ![]() |
create a thread and post it
![]() This menu system could be used when you dont want to give a user full access to the computer and only want to give them a few commands. you could set it up for when ever they ssh into the machine the menu automaticly runs and then with they exit the menu it could log out of the computer for them and then the only access they get is what you give them on the menu ![]()
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Sounds like a really good idea to me.
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() ![]() |
Looks pretty good man, I'm going to put it on my Fedora Core 3, Gentoo, Ubuntu, and Solaris 10 boxes to test it out for ya... maybe add a bit to it too.
Feelings are hurt cuz you don't have a "Compile C program" option... lol
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#6 |
|
PFO Founder
![]() ![]() |
i couldnt think of anymore options to put into it but thats a good one. if you modify it let me know i would like to see what other options would be good to add to it
![]() just figured this out if you add this to the users .profile file then it will run automaticly when they login via ssh ![]() ok i have added a compile c++ and c options and even a run a.out cause thats what the code compiles to on my computer when i dont get a specific name menu #bin/sh
cd
clear
/home/big_k/menu/menu.awk
while :
do
read INPUT_STRING
case $INPUT_STRING in
1)
echo "Enter the name or ip of computer you want to connect to."
read ssh_string
echo "Enter your user name for this machine."
read user_string
ssh -l $user_string $ssh_string
clear
/home/big_k/menu/menu.awk
;;
2)
clear
mc
clear
/home/big_k/menu/menu.awk
;;
3)
clear
echo "Option 3 is Unused"; echo
/home/big_k/menu/menu.awk
;;
4)
echo "Enter File to change permissions of."
read file_perm
echo "Enter permissions you want to use, using the number system."
read perm
chmod $perm $file_perm
clear
echo "File permissions have been changed."; echo
/home/big_k/menu/menu.awk
;;
5)
echo "Enter Directory to change permisions of."
read dir_perm
echo "Enter permissions you want to use, using the number system."
read perm2
chmod -R $perm2 $dir_perm
clear
echo "Directory permissions have been changed."; echo
/home/big_k/menu/menu.awk
;;
6)
clear
ls -la | less
echo
/home/big_k/menu/menu.awk
;;
7)
echo "Enter the Directory you want to move to."
read dir
cd $dir
clear
/home/big_k/menu/menu.awk
;;
8)
clear
echo "Enter File you want to edit"
read file
vim $file
clear
/home/big_k/menu/menu.awk
;;
9)
clear
echo "Enter C++ Program to compile."
read file
g++ $file
/home/big_k/menu/menu.awk
;;
10)
clear
echo "Enter C Program to compile."
read file
gcc $file
/home/big_k/menu/menu.awk
;;
11)
clear
a.out
/home/big_k/menu/menu.awk
;;
clear)
clear
/home/big_k/menu/menu.awk
;;
//)
echo "Exiting!"
break
;;
*)
echo "Sorry, I don't understand"
;;
esac
donemenu.awk awk 'BEGIN { menu="************** MENU ****************\n"
menu=menu "* 1) SSH To Remote Computer *\n"
menu=menu "* 2) Midnight Commander *\n"
menu=menu "* (Command line file manager) *\n"
menu=menu "* 3) Still Not Used *\n"
menu=menu "* 4) Change File Permissions *\n"
menu=menu "* 5) Change Dir Permissions *\n"
menu=menu "* 6) List Files in Directory *\n"
menu=menu "* 7) Change Directory *\n"
menu=menu "* 8) Edit File in Direcotry *\n"
menu=menu "* 9) Compile C++ Program *\n"
menu=menu "* 10) Compile C Program *\n"
menu=menu "* 11) Run a.out *\n"
menu=menu "* *\n"
menu=menu "* clear) Clear Screen *\n"
menu=menu "* //) Quit to Prompt *\n"
menu=menu "************************************\n"
menu=menu "\n"
menu=menu "Enter Your Selection: "
print menu }'
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#7 |
|
Programming Guru
![]() ![]() ![]() |
Just added a few changes to the compile options to where you can put in a name for the binary that was created.
Changed the run a.out option to Run Program... so you can run any program you want (that you have perms to run). Also, removed the cd command from the top of menu.sh to make the menu work with the current directory or directory specified instead of defaulting to home directory. These are minor, trivial changes... that I needed for my "instance" of Big K's menu script. Good work man! menu.sh ----------- 9)
clear
echo "Enter C++ Program to compile."
read file
echo "Enter program name: "
read pname
g++ $file -o $pname
menu.awk
;;
10)
clear
echo "Enter C Program to compile."
read file
echo "Enter program name: "
read pname
gcc $file -o $pname
menu.awk
;;
11)
clear
echo "Enter program to run:"
read pname
$pname
menu.awk
;;menu.awk ------------- menu=menu "* 11) Run Program *\n"
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|