How to create a dynamic list?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to create a dynamic list?
# 1  
Old 01-13-2005
How to create a dynamic list?

Hi falks,

I need to write a function in k-shell which cd to root directory and ask the user which sub directory you want to tar.
The user will select directories untill quit.
How to do it?

Thanks in advance,
Nir
# 2  
Old 01-13-2005
This isnt a homework question, right? I'll give you a simple psuedocode with no error-checking. Something like:

cd /
Ask for input (read command)
while reply not equal -1
do
tar reply
Ask for input(read command)
done
# 3  
Old 01-13-2005
Hey dangral,

Thanks a lot!
It's defenetly not a home work assignment.
It's for a migrator tool i'm writing in the last days.

Regards,
Nir
# 4  
Old 01-13-2005
ksh has a built-in function called "select", which you may find useful.
man ksh for details.
# 5  
Old 01-14-2005
Hi Ygor,

Thanks for your reply.
I've checked the "select" command and this is exactly what i was looking for.

Regards,
Nir
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create Dynamic if condition

Create Dynamic If condition Hi, I have a file color.txt which has data as shown below Red Blue Green Yellow White Pink Black Based on a variable I execute a tail command as shown below tail -${LEFT_OVR} color.txt LEFT_OVR can be any number less than count of number of lines in a... (7 Replies)
Discussion started by: wahi80
7 Replies

2. Shell Programming and Scripting

Create, validate and using dynamic variables in Bash scripting

Hi All, I am really struggling to solve this problem, this might be small but I am not able to, can somebody help me? I have few directories and these directories receives text files in large amount with in fraction of seconds. So I just want to send all the files in current directory to... (2 Replies)
Discussion started by: VasuKukkapalli
2 Replies

3. Shell Programming and Scripting

Dynamic case creation based on output list from a command

I am attempting to create a script that would allow me to list all the instances associated with a DB2 and then prompt the user to choose which one to issue the db2profile command against. I use the db2 command db2ilist to get a list of the instances for a particular server, but the number of... (7 Replies)
Discussion started by: slatoms
7 Replies

4. Red Hat

Dynamic case creation based on output list from a command

I am attempting to create a script that would allow me to list all the instances associated with a DB2 and then prompt the user to choose which one to issue the db2profile command against. I use the db2 command db2ilist to get a list of the instances for a particular server, but the number of... (1 Reply)
Discussion started by: slatoms
1 Replies

5. Shell Programming and Scripting

Help Create dynamic ksh script from a script

I am currently running 2 scripts to gather data for a 3rd script and would like to combine the 2 scripts into one. Having issues with the final output format. Note cannot post URL so replaced the http stuff with (name) in the examples All scripts contain #!/bin/ksh OS = Red Hat Enterprise... (0 Replies)
Discussion started by: pcpinkerton
0 Replies

6. UNIX for Dummies Questions & Answers

Create a phone list

Is there a step by step instructions for creating a simple phone list? (3 Replies)
Discussion started by: organcory
3 Replies

7. UNIX for Advanced & Expert Users

Sql dynamic table / dynamic inserts

I have a file that reads File (X.txt) Contents of record 1: rdrDESTINATION_ADDRESS (String) "91 971502573813" rdrDESTINATION_IMSI (String) "000000000000000" rdrORIGINATING_ADDRESS (String) "d0 movies" rdrORIGINATING_IMSI (String) "000000000000000" rdrTRAFFIC_EVENT_TIME... (0 Replies)
Discussion started by: magedfawzy
0 Replies

8. UNIX for Dummies Questions & Answers

How to obtain list of object files in a shared (dynamic) library?

How can I simply obtain a list of the object files in a shared (dynamic) library. I am looking for the equivalent of "ar -t <lib>" for archived (static) libraries. Thanks in advance. :rolleyes: ---------- Post updated at 01:47 PM ---------- Previous update was at 12:16 PM ---------- The... (1 Reply)
Discussion started by: chatieremerrill
1 Replies

9. Shell Programming and Scripting

How to create a list of entries without vi

Hi Is there a way to create a list of entries in a file without using vi to create this list ? I like to write a shell script that would create a list like this: apple : 2 orange : 4 pear : 3 Any tips/suggestions ? Thanks (3 Replies)
Discussion started by: mpc8250
3 Replies

10. Shell Programming and Scripting

passing a list of dynamic names to a "PS" command in shell script?

Hi, I am new to shell script. This is my first post .I have written a small script which returns list of names starts with "ram" in /etc/passwd .Here is that:- #!/bin/ksh NAME_LIST="name_list.txt" cat /dev/null > $NAME_LIST evalcmd="cat /etc/passwd | grep "^ram?*" | cut -d: -f1" eval... (3 Replies)
Discussion started by: sachin.tendulka
3 Replies
Login or Register to Ask a Question