LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Bash Programming Advice (https://www.linuxquestions.org/questions/linux-software-2/bash-programming-advice-185693/)

Beppe83 05-25-2004 01:05 PM

Bash Programming Advice
 
Hi!

I have to program a little bash script for school, but I don't really know how and they haven't teach us how-to; well that is what I have to do:

create an interface where it displays the current file/folder in a directory ok? Well I must add some option that the user can select by pressing 1, 2, ... ok? These options are:

- go to up folder
- see only folders or files
- order files or folders by name, date
- see only first n files / folders

I need help from someone who knows bash scriping...and I'm sure you know it...I really appreciate this!

ThanX!
Beppe

Nis 05-25-2004 01:22 PM

Check the Advanced Bash Scripting Guide for a lot of help. You can use basic Bash scripting or you could use curses (Google for that). If you really want to impress your Prof., and you've got GNOME and zenity on the target machine, you could use zenity to make GTK dialogs. I wouldn't advise turning only a zenity-based thing in, however, because zenity would make it too easy to do everything you ask.

vinay_s_s 05-25-2004 01:27 PM

also try this:

man bash
man ls
man for
man do
...... a never ending list :)

drjekyll 05-25-2004 01:45 PM

If you want to create a simple bash menu (command line), I think that you may want to follow that:

Print a screen with options. (see "man echo")
Wait what user type (see "man read")
(also see "man while") -"while :" is always true-
do the option's action and print menu again -see man's posted before-

Advanced Bash Scripting Guide are very powerfull, but too hard. O'rreily Learning the bash shell are basic.
Good luck

Beppe83 05-25-2004 05:11 PM

Oh thanks men! Tomorrow I will begin writing down some code!!

I appreciate this!


All times are GMT -5. The time now is 04:29 AM.