Sponsored Content
Full Discussion: multiple word check
Top Forums Shell Programming and Scripting multiple word check Post 302383850 by Scott on Thursday 31st of December 2009 08:30:07 PM
Old 12-31-2009
Code:
$ cat Test
value=${1:-0}

case "$value" in
  2.01|3.01|4.09|1.11|orange) echo "Do something...";;
  *) echo "Do something else..."
esac

$ ./Test ora
Do something else

$ ./Test 2.99
Do something else

$ ./Test orange
Do something...

$ ./Test 3.01
Do something...

What shell are you using - what is meant by {} ?

Also, what is meant by "left value" and "right value", and by "value will be passed dynamically"?. Dynamically how?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check a word position in a file ?

Hello everybody, I have a file like this : "window 1 truck 3 duck 2... fire 1... etc..." and I would like to print the following number of a word I am searching for. (For example here, if I search for the word "fire", I will print "1") Thank you for your help ! (7 Replies)
Discussion started by: tibo
7 Replies

2. Shell Programming and Scripting

Check Word if exist on file or not

Hello, I want to check if some word exist or not on some file By Example : word is : nixcraft file called : /root/shell.txt and i want to check if nixcraft word exist on /root/shell.txt file with if statement or another tool Any Ideas (5 Replies)
Discussion started by: LinuxCommandos
5 Replies

3. Shell Programming and Scripting

perl (word by word check if a hash key)

Hi, Now i work in a code that 1-get data stored in the database in the form of hash table with a key field which is the " Name" 2-in the same time i open a txt file and loop through it word by word 3- which i have a problem in is that : I need to loop word by word and check if it is a... (0 Replies)
Discussion started by: eng_shimaa
0 Replies

4. Shell Programming and Scripting

To check a word is number or not

Hi, I have one file like 00123. And this file name is generated as a sequence. So how can I confirm the generated file name is a number, not a special character or alphabets. Can anybody help me out. Thanks in advance. (3 Replies)
Discussion started by: Kattoor
3 Replies

5. Programming

C++ > check if a file contains a word...

I wanna check if a file located in /home/user/.config/Home/unkilled.txt contains the word 'permitted'... I am a beginner in C++. This is my code: 1. #include <stdio.h> 2. #include <cerrno> 3. #include <sys/stat.h> 4. #include <fstream> 5. #include <sys/types.h> 6. #include... (1 Reply)
Discussion started by: hakermania
1 Replies

6. Shell Programming and Scripting

WORD SEARCH - CHECK IF CORRECT!

Im currently working on a Script using PICO editor, the scripts purpose is : When you typed a certain "word" and press enter, All directories, Script, and any other files that contain that "word" will be displayed.. for example i typed "DOG".. all executable script, Directories, and any other... (3 Replies)
Discussion started by: jenimesh19
3 Replies

7. Homework & Coursework Questions

Word Search: Can you please check if this is correct. thanks!

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Im currently doing a search command.. for example , when i typed a certain word , lets say "DOG".. all... (7 Replies)
Discussion started by: jenimesh19
7 Replies

8. Shell Programming and Scripting

Check a specific word whether is in file

I want to valid a specific word whether it is contained in the text file. For example: family.txt father mother son sister if ("father" contain in family.txt) do some process else do other process How shell scripting can accomplish this? Anyone can provide helps? (3 Replies)
Discussion started by: alvin0618
3 Replies

9. UNIX for Dummies Questions & Answers

Word check within file

I am trying to see if a word exists within the file, then do command accordingly. cmd=$(grep -ci "$word" $file) if ; then echo "Word exists" else echo "Word does not exist." fiI try this code, but it keeps giving me syntax errors for the cmd line. Am I doing something... (3 Replies)
Discussion started by: itech4814
3 Replies

10. UNIX for Beginners Questions & Answers

UNIX script to check word count of each word in file

I am trying to figure out to find word count of each word from my file sample file hi how are you hi are you ok sample out put hi 1 how 1 are 1 you 1 hi 1 are 1 you 1 ok 1 wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies
Test::Unit::Assertion(3pm)				User Contributed Perl Documentation				Test::Unit::Assertion(3pm)

NAME
Test::Unit::Assertion - The abstract base class for assertions NAME
Any assertion class that expects to plug into Test::Unit::Assert needs to implement this interface. Required methods new Creates a new assertion object. Takes whatever arguments you desire. Isn't strictly necessary for the framework to work with this class but is generally considered a good idea. do_assertion This is the important one. If Test::Unit::Assert::assert is called with an object as its first argument then it does: $_[0]->do_assertion(@_[1 .. $#_]) || $self->fail("Assertion failed"); This means that "do_assertion" should return true if the assertion succeeds and false if it doesn't. Or, you can fail by throwing a Test::Unit::Failure object, which will get caught further up the stack and used to produce a sensible error report. Generally it's good practice for do_assertion to die with a meaningful error on assertion failure rather than just returning false. AUTHOR
Copyright (c) 2001 Piers Cawley <pdcawley@iterative-software.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
o Test::Unit::Assert o Test::Unit::CodeRef o Test::Unit::Regexp perl v5.8.8 2006-09-13 Test::Unit::Assertion(3pm)
All times are GMT -4. The time now is 06:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy