Sponsored Content
Top Forums Shell Programming and Scripting If a string variable value exists in a set of values Post 302894588 by Pandee on Wednesday 26th of March 2014 09:42:31 AM
Old 03-26-2014
If a string variable value exists in a set of values

Can some one please help me with the syntax in shell script for the below :
Code:
if $var1 exists in ('val1','val2','val3')

I want to execute a set of commands if the value of var1 variable matches any one of the given string values. Please let me know if there are any other option to go by.

Thanks

Last edited by Pandee; 03-26-2014 at 10:56 AM.. Reason: code tags please
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

COMPARING STRING VALUES TO A VARIABLE and return code dignostics

Hey Folks and Gurus there I am trying to replicate this logic in bash : (1) if ; then function1 parameters & function2 parameters & fi Is there an easy method esp one with regex that can do this comparision. e.g. $var is compared to this list ( case regardless ) (... (1 Reply)
Discussion started by: sieger007
1 Replies

2. UNIX for Dummies Questions & Answers

set sub-string as variable

Hi all, i really new in linux and just heard about shell scripting couple days ago.. i did exercises on linux in online tutorial but as a beginner, i'm facing problems in developing the script as there are errors that sometimes i dun have any idea on how to solve it.What i'm doing now is not... (3 Replies)
Discussion started by: tedy2808
3 Replies

3. Shell Programming and Scripting

Howto set string variable in TCL?

Anyone knows how to set variable in TCL ? let say i have a password variable and it will have different values. set variable and variable has different values like: xxxx yyyy zzzz (0 Replies)
Discussion started by: linuxgeek
0 Replies

4. Shell Programming and Scripting

BASH - set specific user variable via string operators

Apologies for the utter triviality of this question, but we all have to start somewhere! I've also tried searching but this question is pretty vague so I didn't (a) really know what to search for or (b) get many relevant hits to what I did search for. Anyway, I'm in the process of self-teaching... (1 Reply)
Discussion started by: u5j84
1 Replies

5. Shell Programming and Scripting

Assigning a set of values to a variable

I wnat to assign a set of values to a variable and use it in if condition. for example: i=$1 d=1 2 3 4 5 6 if then echo "Fine" else echo "Check" fi i will either of the value in d, i.e. i can be 1 or 2 or any value in d, How this can be done? Thanks in advance (2 Replies)
Discussion started by: sol_nov
2 Replies

6. Shell Programming and Scripting

Test if string exists

How do I use bash to test whether a string occurs more than two times in a file? (2 Replies)
Discussion started by: locoroco
2 Replies

7. Shell Programming and Scripting

ENQUIRY WHETHER SCRIPT FOR DETECTING WORDS FROM A SET OF LETTERS EXISTS

Hello, I am interested in finding out whether someone has a perl or awk script which takes a set of letters such as wak and referring to a dictionary spews out all possible forms such as awk, kaw etc. If someone has such a script, could it be put up please. The script should handle Unicode. Many... (0 Replies)
Discussion started by: gimley
0 Replies

8. Shell Programming and Scripting

How to get value from array and set those values as a variable

I am new to ksh scripting, specially array. How do i get values from an array and set the value as variable and pass those variables to the different functions?? someone taught me how to get input from a file with have columns i need to read, but now i doesnt know how to set those value to be a... (7 Replies)
Discussion started by: gavin_L
7 Replies

9. Programming

[LUA] Set variables according to if file exists

Heya I'm using Awesome WM with the Vicious widget library. As i'm using multi boot, Win8, Fedora and Arch, i have my WM-Config shared accross my GNU/Linux installations. The regarding snippet: -- Functions -- Its just a workaround for an 'unstable' 'hwmon/hwmon' definition of Fedora21 -... (0 Replies)
Discussion started by: sea
0 Replies

10. Shell Programming and Scripting

Check if 2 input values exists in a file

I have a file number.txt.I need to get 2 inputs from the terminal like a=100 and b=200.If a and b are there in the file,then check if a < b,print "less".If a is not there in the file,print "a is missing" or if b is not there in the file,print "b is missing". number.txt: 100 200 300 (2 Replies)
Discussion started by: aneeta13
2 Replies
avifix(1)						      General Commands Manual							 avifix(1)

NAME
avifix - fix header of AVI-file SYNOPSIS
avifix [ -i name [ -F string ] [ -f val1,val2 ] [ -N 0x NN ] [ -b bitrate ] [ -e rate[,bits[,channels]] ] [ -a num ] [ -v ] ] COPYRIGHT
avifix is Copyright (C) by Thomas Oestreich. DESCRIPTION
avifix fixes the header of an AVI-file with the supplied parameters. OPTIONS
-i name Specify the name of the AVI-file. -F string Specify the video codec as FourCC. Possible values are RGB, RIFF and TIFF. ??? -f val1,val2 Use this option to change the frame rate and scale information in the header of the AVI-file. Both values must not be < 0. -N 0xnn Use this option to change the audio format identifier in the header of the AVI-file. Here are some possible values: 0x1 PCM uncompressed audio 0x50 MPEG layer-2 aka MP2 0x55 MPEG layer-3 aka MP3 0x2000 AC3 audio -b bitrate Use this option to change the encoder bitrate in the header of the AVI-file. bitrate has to be given in units of kbps. -e rate[,bits[,channels]] Use this option to change the audio stream parameters of in the header of the AVI-file. -a num Use this option to change the audio stream parameters of audio track number num in the header of the AVI-file. -v Print version information and exit. EXAMPLES
The command avifix -i my_file.avi -f 30,1 changes the header of the file my_file.avi and sets the frame rate to 30 fps. AUTHORS
avifix was written by Thomas Oestreich <ostreich@theorie.physik.uni-goettingen.de> with contributions from many others. See AUTHORS for details. SEE ALSO
avimerge(1), avisplit(1), tccat(1), tcdecode(1), tcdemux(1), tcextract(1), tcprobe(1), tcscan(1), transcode(1) avifix(1) 16th January 2002 avifix(1)
All times are GMT -4. The time now is 09:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy