LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-29-2005, 12:29 AM   #1
tomarkblake
LQ Newbie
 
Registered: May 2005
Posts: 3

Rep: Reputation: 0
Need help with shell script


I know this is a big ask, but I need to write a shell script that acts as a menu system. It needs to

1/ Clear the screen
2/ Print out a menu list with a number at the front of each menu item
3/ Wait for a selection by printing a prompt

The menu tasks are

1/ Show the path environment variable
2/ Display the home directory usage for a user
3/ List all users on the system
4/ Exit

Scripts are certainly not my strong point, so if anyone can point me to a resource that can teach me how to achieve the above, I would be very greatful.

Thanks in advance,
Mark
tomarkblake@hotmail.com
 
Old 05-29-2005, 02:00 AM   #2
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
you could check out

http://www.tldp.org/LDP/Bash-Beginne...tml/index.html
http://www.linuxcommand.org/

and you could post back your trials so we could help you out
 
Old 05-29-2005, 06:24 AM   #3
tomarkblake
LQ Newbie
 
Registered: May 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks heema, I am trying to understand it, though I am finding it hard, Ill keep trying. Thanks for your help
 
Old 05-29-2005, 06:32 AM   #4
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
No problems

its hard at first but when you learn it you will find that you could do a script that does anything that you want , and you will soon discover the power of scripting and linux
 
Old 05-29-2005, 05:57 PM   #5
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
here's a skeleton for 'ya:
Code:
clear
select i in 1 2 3 4; do
  case i of
    1) echo $PATH ;;
    2) ;;
    3) who ;;
    4) exit
    *) echo bad selection
  esac
  clear
done
hth --Jonas
 
Old 05-30-2005, 01:29 AM   #6
tomarkblake
LQ Newbie
 
Registered: May 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you very much jonas, I really apreciate it, you are a great help!!!
Mark
 
Old 05-30-2005, 01:31 AM   #7
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
yw

but watch out for my broken code: `echo' followed by `clear' is rather lame, so kids: don't do that at home

Last edited by jonaskoelker; 05-30-2005 at 01:32 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration