Sponsored Content
Full Discussion: Case question
Top Forums Shell Programming and Scripting Case question Post 302883010 by Yoav on Friday 10th of January 2014 11:38:54 AM
Old 01-10-2014
Case question

Hi,
ksh script.

I have a shell script which use while loop and case statment in order to execute several functions.
Each step is working fine .
I want to add a new dynamic option : from step X to step Y which go through the selected steps .
for example : from step 2 to 3 , will execute option 2+3 only (function 2 and function 3) in the menu bellow.

Please advise.
Thanks

Code:
while :
do
  clear
  echo "----------------------------------------------"
  echo " * * * * * * * Steps * * * * *  * * "
  echo "----------------------------------------------"
  echo "[1]  Step1 "
  echo "[2]  Step2 "
  echo "[3]  Step3 "
  echo "[0]  Exit  "
  echo "----------------------------------------------"
  echo -n "Choose Option [0-3]:"
  read yourch
  case $yourch in
    0) exit 0
       ;;
    1)  function1 ;;
    2)  function2 ;;
    3)  function3 ;;
    *) echo " Please select choice 1,2,3 OR all"
    echo "Press a key. . ."
       ;;
  esac
done


Last edited by bartus11; 01-10-2014 at 12:45 PM.. Reason: Please use code tags.
 

9 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

To CASE or not to CASE, this is my question!

Hi I'm trying to display the permissions, owner and group of a file. So far so good! Script 4 #To determine the permissions, owner and group of a file #Syntax: script4 filename LINE=`ls -ltr $1` OWNER=`echo $LINE | awk '{print $3}'` GROUP=`echo $LINE | awk '{print $4}'`... (1 Reply)
Discussion started by: olimiles
1 Replies

3. Shell Programming and Scripting

Script needed to select and delete lower case and mixed case records

HELLO ALL, URGENTLY NEEDED A SCRIPT TO SELECT AND DELETE LOWER AND MIXED CASE RECORDS FROM A COLUMN IN A TABLE. FOR EXAMPLE : Table name is EMPLOYEE and the column name is CITY and the CITY column records will be: Newyork washington ... (1 Reply)
Discussion started by: abhilash mn
1 Replies

4. Shell Programming and Scripting

case question

hi all i have script call tmp1 run_object1 run_object2 case $? in 0) ;; *) echo "error try again" read an ;; esac can some one please explain to me from the case till the end of the script ? thanks (2 Replies)
Discussion started by: naamas03
2 Replies

5. Shell Programming and Scripting

data array needs to change upper case to lower case

Hi all, i have a data array as followes. ARRAY=DFSG345GGG ARRAY=234FDFG090 ARRAY=VDFVGBGHH so on.......... i need all english letters to be change to lower case. So i am expecting to see ARRAY=dfsg345ggg ARRAY=234fdfg090 ARRAY=vdfvgbghh so on........ If i have to copy this data in... (8 Replies)
Discussion started by: usustarr
8 Replies

6. Shell Programming and Scripting

[Solved] Change Upper case to Lower case in C shell

Is there a command that can switch a character variable from UPPER case to lower case? like foreach AC ( ABC BCD PLL QIO) set ac `COMMAND($AC)` ... end Thanks a lot! (3 Replies)
Discussion started by: rockytodd
3 Replies

7. Shell Programming and Scripting

Question about REGEX Patterns and Case Sensitivity?

Hello All, I'm in the middle of a script and I'm doing some checks with REGEX (i.e. using the '"shopt -s nocasematch" that at least the first one should print "FALSE" but it prints "TRUE"..? For Example: #!/bin/bash MY_VAR="HELLO" ### This prints "TRUE" PATTERN_1="^*" if ] then... (5 Replies)
Discussion started by: mrm5102
5 Replies

8. Shell Programming and Scripting

Awk-sed : Question getting case sensitive filed.

Experts, Good day!, I have following data, I want to filter 3rd Field, if it is in UPPERCASE, aa aa1 HOST1 aa bb1 host2 aa cc1 SERV1 aa dd1 SERV2 ab aa1 host3 The output should be: aa aa1 HOST1 aa cc1 SERV1 aa dd1 SERV2 (2 Replies)
Discussion started by: rveri
2 Replies

9. Shell Programming and Scripting

Change first letter of a word from lower case to upper case

Hi all, I am trying to find a way to change first letter in a word from lower case to upper case. It should be done for each first word in text or in paragraph, and also for each word after punctuation like . ; : ! ?I found the following command sed -i 's/\s*./\U&\E/g' $@ filenamebut... (7 Replies)
Discussion started by: georgi58
7 Replies
MSSQL_FIELD_SEEK(3)													       MSSQL_FIELD_SEEK(3)

mssql_field_seek - Seeks to the specified field offset

SYNOPSIS
bool mssql_field_seek (resource $result, int $field_offset) DESCRIPTION
Seeks to the specified field offset. If the next call to mssql_fetch_field(3) won't include a field offset, this field would be returned. PARAMETERS
o $result - The result resource that is being evaluated. This result comes from a call to mssql_query(3). o $field_offset - The field offset, starts at 0. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Using mssql_field_seek(3) on the example for mssql_fetch_field(3) <?php // Connect to MSSQL and select the database mssql_connect('MANGOSQLEXPRESS', 'sa', 'phpfi'); mssql_select_db('php'); // Send a select query to MSSQL $query = mssql_query('SELECT * FROM [php].[dbo].[persons]'); // Construct table echo '<h3>Table structure for 'persons'</h3>'; echo '<table border="1">'; // Table header echo '<thead>'; echo '<tr>'; echo '<td>Field name</td>'; echo '<td>Data type</td>'; echo '<td>Max length</td>'; echo '</tr>'; echo '</thead>'; // Dump all fields echo '<tbody>'; for ($i = 0; $i < mssql_num_fields($query); ++$i) { // Fetch the field information, notice the // field_offset parameter is not set. See // the mssql_field_seek call below $field = mssql_fetch_field($query); // Print the row echo '<tr>'; echo '<td>' . $field->name . '</td>'; echo '<td>' . strtoupper($field->type) . '</td>'; echo '<td>' . $field->max_length . '</td>'; echo '</tr>'; // Move the internal seek pointer to the next // row in the result set mssql_field_seek($query, $i + 1); } echo '</tbody>'; echo '</table>'; // Free the query result mssql_free_result($query); ?> SEE ALSO
mssql_fetch_field(3). PHP Documentation Group MSSQL_FIELD_SEEK(3)
All times are GMT -4. The time now is 06:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy