Sponsored Content
Full Discussion: Read with two values
Top Forums Shell Programming and Scripting Read with two values Post 302916701 by newbie2010 on Thursday 11th of September 2014 11:35:56 AM
Old 09-11-2014
Read with two values

I have a script like this:

Code:
read -e -r -p "enter name of product in CAPS:  " ITEM
echo -e "Please enter the product number"
read -e -r -p "Enter list at date:" list

#Here someone enters case6 for ITEM

Code:
if [[ $ITEM == case6 ]]; then ITEMLST=`echo CASESIX`;fi

Then I have commands that look for the directory CASESIX and retrieves files: This command uses $ITEMLIST as the variable


after that I want to be able to ssh to case6:.

Code:
for i in `cat /tmp/productlist`; do su ncacct -c "ssh $ITEM /usr/query -m $i""" |
gawk '{if ($3 == "TLD") print "product '$i' is in truck"}';done

The problem is that I want the user to be able to enter either case6 or CASESIX and have the script go to the directory CASESIX which value "ITEMLST" holds.

Right now they must enter case6 and then the variable will get translated to CASESIX for the directory CASESIX. after that the ssh command will use "case6" as the value and ssh to the host case6

Is there a way to do this other than to make someone enter case6 for the read command? I would like if someone could enter case6 or CASESIX in that read command somehow and have the last command know that it should use case6 to ssh. Maybe it is not possible?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read values from a file

Hi , I have a file with the following content I need the read the year and reporting from this file and store them in variables. I understand that we can read the file delimited by'=' but not sure how to extract the values correctly. Thanks in advance Regards (3 Replies)
Discussion started by: w020637
3 Replies

2. Shell Programming and Scripting

read column values one after another

hi, Can some one help me how to retrieve column values row by row My requirement is like below : I have a text file having comma seperated values of these records . OName OType SrcDB Sschema targetdb TSchema Load Dataype processY/N aa Table a e i m Y db2 y aa index b c d e N sql N ... (4 Replies)
Discussion started by: sailaja_80
4 Replies

3. Shell Programming and Scripting

Not able to read unique values in array

Hi Friends, I am having some trouble reading into an array. Basically, I am trying to grep for a pattern and extract it's value and store the same into an array. For eg., if my input is: <L:RECORD>name=faisel farooq,age=21, company=TCS,project=BT</L:RECORD> <L:RECORD>name=abc... (1 Reply)
Discussion started by: faiz1985
1 Replies

4. Shell Programming and Scripting

AWK: read values from file1; search for values in file2

I have read another post about this issue and am wondering how to adapt it to my own, much simpler, issue. I have a file of user IDs like so: 333333 321321 546465 ...etc I need to take each number and use it to print records wherein the 5th field matches the user ID pulled from the... (2 Replies)
Discussion started by: Bubnoff
2 Replies

5. Shell Programming and Scripting

Read variables and their values from file

Hi, I want to read the variables and the values from the txt file and compare these values with the ones computed by script. for ex: say var.txt contains the variable names and their values: one 1 two 2 three 3 The value of variables "one" "two" and "three" will be computed in the script... (3 Replies)
Discussion started by: bhushana
3 Replies

6. Shell Programming and Scripting

To read the values and to use in the where condition

Hi, I have the below values in a text file. 'xx.16397950', 'xx.16397957', 'xx.16397976', 'xx.16473259', I need to use in the where clause of the sql query in my unix shell script. How to read one by one value. It should be like this: select * from <<table name>> where xx in (... (10 Replies)
Discussion started by: venkatesht
10 Replies

7. Shell Programming and Scripting

Read values from file.

I have a config file of this format: Company= Alpha Tech From Email = AlphaTech@Alphatech.com Pass = Passowrd To Email = abc@hotmail.com Smtp=smtp.live.com:587 I want to read these values from this file and use in a command to send email. I am trying grep but it gives full line. I just... (8 Replies)
Discussion started by: kashif.live
8 Replies

8. Shell Programming and Scripting

While loop to read values

Hi Everyone, I am currently tasked with some reporting on various Unix based OSes. I have a script deployed that runs and grabs the information I am looking for, and has a bit of logic to output the desired result into a text file. Example of my text file: multiUsers=yes... (1 Reply)
Discussion started by: Zaphod_B
1 Replies

9. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

10. Shell Programming and Scripting

awk file to read values from Db2 table replacing hard coded values

Hi, I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below... if (start_new_rec=="true"){ exclude_user="false"; user=toupper($6); match(user, "XXXXX."); if (RSTART ==2 ) { ... (9 Replies)
Discussion started by: asandy1234
9 Replies
mitem_value(3X) 														   mitem_value(3X)

NAME
mitem_value - set and get menu item values SYNOPSIS
#include <menu.h> int set_item_value(ITEM *item, bool value); bool item_value(const ITEM *item); DESCRIPTION
If you turn off the menu option O_ONEVALUE (e.g., with set_menu_opts or menu_opts_off; see menu_opts(3X)), the menu becomes multi-valued; that is, more than one item may simultaneously be selected. In a multi_valued menu, you can used set_item_value to select the given menu item (second argument TRUE) or deselect it (second argument FALSE). RETURN VALUE
The function set_item_value returns one of the following: E_OK The routine succeeded. E_SYSTEM_ERROR System error occurred (see errno). E_REQUEST_DENIED The menu driver could not process the request. SEE ALSO
curses(3X), menu(3X). NOTES
The header file <menu.h> automatically includes the header file <curses.h>. PORTABILITY
These routines emulate the System V menu library. They were not supported on Version 7 or BSD versions. AUTHORS
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. mitem_value(3X)
All times are GMT -4. The time now is 05:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy