Computing.Net > Forums > Linux > Need Help with Basic Bash Script

Need Help with Basic Bash Script

Reply to Message Icon

Original Message
Name: Glendy Lin
Date: February 3, 2003 at 05:38:48 Pacific
Subject: Need Help with Basic Bash Script
OS: Linux
CPU/Ram: I don't know
Comment:

I need help with this basic script writing using bash shell. I just started using Linux and the company I work for is trying to instill this system. How do I write a script that will create a menu to allow the user to see what directory he/she is in, list all the files in the current directory, view the files in the directory, and show current date and time? The menu also has to run continuously until the user makes a choice from the menu that will end the script. I would appreciate any input whatsoever. I thank you so much for your time.



Report Offensive Message For Removal

Response Number 1
Name: Balram Adlakha
Date: February 3, 2003 at 14:21:12 Pacific
Subject: Need Help with Basic Bash Script
Reply: (edit)

Sorry, I didn't quite get your question...
why a menu?
I mean, what kind of a menu? Just something
the gives choices?
ex:
select:
a)blah
b)blahh
c)blaaah
>c
c entered, do

That kind of a menu?
If yes, email me, i'll explain, if no, what
kind of a menu? again email me to tell...

Actually, the tasks that you want to do are
very basic, and you don't need a shell
script for that...
You can set your PS1 environment variable
so that it tells you what directory you are
in...
like the prompt will show:
[localhost@localdomain CURRENT DIRECTRORY]#
most distros already have the PS1 variable
set like this...
You can just do 'dir' or 'ls' to display
the contents, and even set colors for
various types of files...I'm not sure how
its done, but I think typing:
dircolors --help
will give you more information...
dircolors is a tool for doing this very
thing...
And you can set your PS1 variable to display the current time aswell...
So the bash prompt will become:
[localhost@localsomain CURRENT DIR TIME]#


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Need Help with Basic Bash Script

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software