Shell script dynamically case in VAR


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script dynamically case in VAR
# 1  
Old 10-20-2008
Shell script dynamically case in VAR

Hallo,

I am working on a kdialog. This shall be able to load the required commands from a .conf file.

First step runs good by loading the entries (selectabel entries) in a variable:

MIRRORSELECT=$(kdialog --radiolist "Select your nearest mirror" $VAR1)

The kdialog is accordingly correct

MY PROBLEM IS NOW, to set all inside the case in ... done dynamically e.g. via a variable or a function etc.

MIRRORSELECT=$(kdialog --radiolist "Select your nearest mirror" $VAR1)
case $MIRRORSELECT in
$VAR2
esac

I tryed to fill the required data ((VAR2=$(echo " 1) echo "Hallo ;; ...;; ) in the variable and call it inside the case ... in ... $VAR ... done.

It always causes an error message.

Can you help me here?


Tks and krgds
# 2  
Old 10-20-2008
The case statement should looks like:

Code:
  case "$MIRRORSELECT" in
    "$VAR2") echo "VAR2 found";;
    "$VAR3") echo "VAR3 found";;
    *) echo "Not in any VAR";;
  esac

Regards
# 3  
Old 10-20-2008
Tks for your reply,

my problem is here, that I do not know how many lines I expect between the case in ... done brace. That means I cannot prepare Var2, Var3 etc.

So that I have been looking for a dynamic solution to fill it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to apply functions to multiple columns dynamically

Hello, I have a requirement to apply hashing algorithm on flat file on one or more columns dynamically based on header sample input file ID|NAME|AGE|GENDER 10|ABC|30|M 20|DEF|20|F say if i want multiple columns based on the header example id,name or id,age or name,gender and hash and... (13 Replies)
Discussion started by: mkathi
13 Replies

2. Shell Programming and Scripting

Parameterizing to dynamically generate the extract file from Oracle table using Shell Script

I have below 2 requirements for parameterize the generate the extract file from Oracle table using Shell Script. Could you please help me by modifying the script and show me how to execute it. First Requirement: I have a requirement where I need to parameterize to generate one... (0 Replies)
Discussion started by: hareshvikram
0 Replies

3. Shell Programming and Scripting

Creating IN list in PLSQL script dynamically by using shell script

Hi all, I have a PLSQL script which has a IN list where it takes some ids as input. For example SELECT * FROM EMPLOYEE WHERE EMPLOYEE_ID IN (comma separated list ) I want to run this quest inside a shell script but I would like to prepare the IN list dynamically where the employee ids... (1 Reply)
Discussion started by: LoneRanger
1 Replies

4. Shell Programming and Scripting

Generating & executing the SELECT and UPDATE clause dynamically using shell script

Hi All, I need to write one shell script. The requirement is as follows. a) I am having list the employee names in a file stored in /tmp directory location as below /tmp/emp.txt b) and the contents are as below cat emp.txt ravi raj ram arun c) I need to connect to sybase... (1 Reply)
Discussion started by: Gowtham_giri
1 Replies

5. Shell Programming and Scripting

Shell script variable names created dynamically

Hi, I'm trying to use a config file to define frequencies for checking log files. If the config file contains a frequency it will be used else a default value. The format of the config file (and hence the environment variable) is FREQ_log_logname=value A test shell script as below:... (2 Replies)
Discussion started by: u671296
2 Replies

6. Shell Programming and Scripting

Passing filename dynamically in SPOOL of SQL*PLUS in shell script

Hi all, I am executing shell script in which I am using SQLLDR In this SQLLDR I am passing text file having PL/SQL script. This script will produce some formated output, this output I have to spool in another text file. Currently I have given this in script file as following Spool... (2 Replies)
Discussion started by: shekharjchandra
2 Replies

7. Shell Programming and Scripting

how to create the files dynamically in c shell script

how can i CREATE a txt file dynamically in c shell: for instance: #! /bin/csh for each i (*) cat>file$i.txt for each j do .... (1 Reply)
Discussion started by: jdsignature88
1 Replies

8. Shell Programming and Scripting

Dynamically creating text files using shell script

Hi All, I want to create a shell script which dynamically create text files. i am using the following script $i=1 while do cat > test_$i.txt done but while running the script it was stopping(the cursor not going to next step, i have to enter ctrl+c to make it stop). it is creating only... (2 Replies)
Discussion started by: KiranKumarKarre
2 Replies

9. Shell Programming and Scripting

Accessing var from .profile into shell script

I have defined variable in .profile file. This variable, I tried to use in a shell script for the same session. In Shell script it is not finding this variable, but the same variable on the console if I try to access by echo $var, it is giving me correct assigned value. Can anyone, please... (7 Replies)
Discussion started by: videsh77
7 Replies

10. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies
Login or Register to Ask a Question