list of scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting list of scripting
# 1  
Old 07-08-2009
list of scripting

i have this:
1.display display the number of scripts that user have
2.run allow user to run the script
3.clear clear unwanted files that take up space
4.exit end application

how do i write this into codes in the vi editor and allow the user to choose which one to run?
plus how do i run this?
thank...
# 2  
Old 07-08-2009
have you tried anything till now??
I can give you some hints..
use echo to display menu..
use switch case to select the respective option..
search forum you will get many such threads...
# 3  
Old 07-08-2009
Code:
 
#!/usr/bin/bash
 
while :
do
clear
echo "
1. Item 1
2. Item 2
E. Exit
 
Please select choice: \c"
read CHOICE
 
case $CHOICE in
1) echo "Item 1";;
2) echo "Item 2";;
[eE]) exit 0;;
*) echo "Bad choice"
sleep 2;;
esac
done

This is the basic format.

Last edited by vidyadhar85; 07-08-2009 at 07:34 AM.. Reason: Code tag added
# 4  
Old 07-08-2009
while :
do
clear
echo "
1. display-display number of scripts that the user have
2. run-allow user to run one of the scripts
3. clear-clear unwanted file that takes up harddrive space
4. exit-end application

Please select choice
read CHOICE

case $CHOICE
1) echo "1";;
2) echo "2";;
3) echo "3";;
4) echo "4";;
[eE]) exit 0;;
*) echo "Bad choice"

is there any error in the script?
when i run the script
give me "line 19: unexpected EOF while looking for matching '"'
line 31: unexpected end of line"
# 5  
Old 07-09-2009
You are missing the 'esac' to end the case block.
# 6  
Old 08-10-2009
list of scripting

Thank very much... For the help...
# 7  
Old 08-15-2009
Selection is interesting command to make selection. REPLY variable include your input.
Code:
#!/bin/ksh
# or bash
PS3="Your choice (ENTER=menu again, e=end):"
select f in *.sh
do
        [ "$REPLY" = "e" ] && break
        echo "Choice: ($REPLY) $f"
        [ ! -x "$f" ] && echo "not executable" >&2 && continue
        ./$f
        # if like to exit after 1st selection, then add line break
        # break
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Scripting - Select multiple files from numbered list

I am trying to have the user select two files from a numbered list which will eventually be turned into a variable then combined. This is probably something simple and stupid that I am doing. clear echo "Please Select the Show interface status file" select FILE1 in *; echo "Please Select the... (3 Replies)
Discussion started by: dis0wned
3 Replies

2. Shell Programming and Scripting

Implementing linked list in shell scripting

Hello Experts, Is it possible to implement linked list in shell scripting? is yes then how can we do it? Any working example is highly appreciated. Thanks in advance. (4 Replies)
Discussion started by: mukulverma2408
4 Replies

3. Shell Programming and Scripting

Shell Scripting | Return list of unique characters in files

Hi, I am trying to script the below, but I am not very good at it :( Your help would be greatly appreciated. 1. read all files in the directory in strings strings *.* 2. in each file, for each line that contains "ABCD", store characters located at position 521 and 522 of this line... (9 Replies)
Discussion started by: clippertm
9 Replies

4. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

5. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

6. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

7. Shell Programming and Scripting

Shell Scripting Reading List

Hello Everyone, Over the last few months I have begun to expand my programing skills from windows, Java and SQL / PL-SQL programing into the wonderful world of shell scripting. With little training budget my only options for training are books, Internet and this site (BTY... (1 Reply)
Discussion started by: caddis
1 Replies

8. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

9. Shell Programming and Scripting

Need scripting help in :Adding 20% to a list of number :

Hi Experts, I want to add 20% to the values and get an output , please advise with script , awk etc, # cat datafile.txt 50.4053 278.383 258.164 198.743 4657.66 12.7441 646.787 1.56836 23.2969 191.805 53.3096 1.12988 999.058 4100.29 (2 Replies)
Discussion started by: rveri
2 Replies

10. Shell Programming and Scripting

scripting guru's pls help me with scripting on AIX

can someone pls help me with the script for a files coming from one system to a particular directory and i want to write a script to move those files to another directory on different system by renaming the files... pls someone help me on this... thanking in anticipation.... (1 Reply)
Discussion started by: thatiprashant
1 Replies
Login or Register to Ask a Question