Loop logic, enter into respective IF as per enter input file name
have three big data file, however I just need to see the mentioned below one line form the all the file which has SERVER_CONNECTION Value
File 1
File2
File3
One varaible i.e Test=dvlna002
now my requirement is to compare the values
Condition 1 for file1 : compare variable "Test" with "dvlna002" (this come from file 1 by grep command see the script ) if matches return "SAME" else "NOT SAME"
Condition 2 for file2: compare variable "Test" with "[SERVER" (this come from file 2 by grep command see the script) if matches return "SAME" else "NOT SAME"
Condition 3 for file3: compare variable "Test" with "dvlna003" (this come from file 3 by grep command see the script) if matches return "SAME" else "NOT SAME"
Output Result should be
Condition 1 >> SAME
Condition 2 >> NOT SAME
Condition 3 >> NOT SAME
I want to first write in the script that entre the file name and on the basis of file name entred by user it should go to the respective IF condition
Example : like I entered File 1 then it should only go to Condition 1 which check for Test = "dvlna002" , if it satisfy it just send me output of "SAME"
As of now I have written the script which is like this, I am unable to but the logic where it decide on which if condition it should go
Last edited by Scrutinizer; 08-24-2013 at 02:56 PM..
Reason: code tags
I'm working on making a menu system on an HP-UX box with Bash on it. The old menu system presents the users with a standard text menu with numbers to make selections. I'm re-working the system and I would like to provide something more akin to iterative search in Emacs.
I have a list of 28... (2 Replies)
how to wrote a script that reads an input from the reader (dir name) and then answer yes to all questions in the script unless the answer to any of the questions contains a certain string?
example:
$] script.sh dir_name
$] question_1: (answer should be y right after the question is echoed,... (3 Replies)
Hi
I am stucked in the below script .I want to input with yes/no from the user and then execute the code inside if but it is not working .I just need the logic as where I am wrong so that i can use the same in my work .
then
echo "Hi All"
fi
].
Please suugest . (4 Replies)
hi experts
Question in perl
i'm creating a script to take from user a different inputs one of them is the carriage return .. so that i want to make an if condition if the user hit enter key the user will go to previous step
it something like that
chomp ($input = <STDIN>);
if ($input =~... (3 Replies)
Hi
I have a file like so:
Code:
Frank Peter Tony Robert Mike 1 2 3 4 5 5 4 2 3 1 4 3 1 5 2
My out should look like this:
Peter
Tony
Mike
and so on....
I have the first part done to ask the user to... (8 Replies)
HI
i have written a script to ask input from the user.
this script should promote the user for y/n input. if user enters anyother input then y/n
the script promotes him again. this below code is working fine for all the cases.
except for space and enter " if i give space and enter it is... (2 Replies)
Is the below correct syntax for if the user enters something other than "GJB2 or MECP2, or PHOX2B", then they are shown on the screen format.txt and allowed to enter in one of those formats? Thank you :).
Basically, the user can see which formats are allowed and enter a variant while viewing... (7 Replies)
I am looking for a way to start a script and have it prompt for a password that will be used later on in the script to SSH to another host and to SFTP. I don't want the password to be hard coded. Below is my script with the actual IP's and usernames removed.
#!/usr/bin/expect -f... (2 Replies)
Hi,
This is a script which to create an opvn user, I want which answer automatically to a certain part so, I try this, it works without the red part but I must type manually.. :
#!/bin/bash
## Environnement ##
LC_ALL=C
## Paths ##
rsa_dir="etc/openvpn/easy-rsa"... (10 Replies)
Hey All,
I am writing one script using expect, that script which is used in spawn will accepts only 1. Enter 2. Ctrl+c
Press Control-C to exit, Enter to proceed.
Could some one share some thoughts to send the above user inputs in linux expect block ?
Thanks,
Sam (0 Replies)