Sponsored Content
Top Forums Shell Programming and Scripting wildcard problems with numbers Post 302567837 by cokedude on Tuesday 25th of October 2011 07:35:04 AM
Old 10-25-2011
wildcard problems with numbers

Can someone please tell me what is wrong with this shellscript? I need to use wildcards because my numbers will be random. My number will be an ip address when I get the syntax right. I would think when I run this I would get the first case and I would see this output.

Code:
VAR1 is 123
----------
Users cannot control this device.
VAR1 is 123

Unfortunately I see this output.

Code:
VAR1 is 123
----------
I like cookies
VAR1 is 123

Code:
#!/bin/bash
VAR1=123
echo VAR1 is $VAR1
echo ----------
if [ $VAR1 = [0-9][0-9][0-9] ]; then
#if [ $VAR1 = 131.247.2.211 ]; then
    echo $"Users cannot control this device." >&2
    echo VAR1 is $VAR1
    exit 1
else
    echo $"I like cookies" >&2
    echo VAR1 is $VAR1
fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find wildcard .shtml files in wildcard directories and removing them- How's it done?

I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days... The structure of the paths are like this: /home/domains/www.domain2.com/tgp/ /home/domains/www.domain3.com/tgp/... (1 Reply)
Discussion started by: Neko
1 Replies

2. UNIX for Dummies Questions & Answers

seperating records with numbers from a set of numbers

I have two files one (numbers file)contains the numbers(approximately 30000) and the other file(record file) contains the records(approximately 40000)which may or may not contain the numbers from that file. I want to seperate the records which has the field 1=(any of the number from numbers... (15 Replies)
Discussion started by: Shiv@jad
15 Replies

3. Shell Programming and Scripting

wildcard

Hi, I have this code to search all "cif" files using wildcard for file in *.cif do grep "Uiso" $file | awk '{ print $3, $4, $5 }' > tet done I get this error "grep: *.cif: No such file or directory" Please where am I going wrong!!! Thank you in advance (6 Replies)
Discussion started by: princessotes
6 Replies

4. Shell Programming and Scripting

read numbers from file and output which numbers belongs to which range

Howdy experts, We have some ranges of number which belongs to particual group as below. GroupNo StartRange EndRange Group0125 935300 935399 Group2006 935400 935476 937430 937459 Group0324 935477 935549 ... (6 Replies)
Discussion started by: thepurple
6 Replies

5. UNIX for Advanced & Expert Users

wildcard help

Can someone please explain the wildcards in this. How is this recursive? When I put this in my terminal it recursively displayed everything. ls .* * (6 Replies)
Discussion started by: cokedude
6 Replies

6. Shell Programming and Scripting

How to use wildcard * in if?

Hi, Can anyone help me how to use * in if statement. File contains below line1:a|b|c|Apple-RED| line2:c|d|e|Apple-Green| line3:f|g|h|Orange| I need to find line by line 4th field contains 'Apple' or not. Please help me at the earliest. (6 Replies)
Discussion started by: jam_prasanna
6 Replies

7. Shell Programming and Scripting

the smallest number from 90% of highest numbers from all numbers in file

Hello All, I am having problem to find what is the smallest number from 90% of highest numbers from all numbers in file. I am having file with thousands of lines and hundreds of columns. I am familiar mainly with bash but I am open to whatever suggestion witch will lead to the solutions. If I... (11 Replies)
Discussion started by: Apfik
11 Replies

8. UNIX for Dummies Questions & Answers

Print numbers and associated text belonging to an interval of numbers

##### (0 Replies)
Discussion started by: lucasvs
0 Replies

9. Shell Programming and Scripting

Wildcard in ls

Hi Experts, I want to use ls in the below form: ls -l *.{txt,TXT} (working fine) but when i am declaring a variable, VAR="*.{txt,TXT}" ls -l $VAR is not working. Please help. Thanks. (4 Replies)
Discussion started by: sugarcane
4 Replies

10. UNIX for Beginners Questions & Answers

Decimal numbers and letters in the same collums: round numbers

Hi! I found and then adapt the code for my pipeline... awk -F"," -vOFS="," '{printf "%0.2f %0.f\n",$2,$4}' xxx > yyy I add -F"," -vOFS="," (for input and output as csv file) and I change the columns and the number of decimal... It works but I have also some problems... here my columns ... (7 Replies)
Discussion started by: echo manolis
7 Replies
clarnv.f(3)							      LAPACK							       clarnv.f(3)

NAME
clarnv.f - SYNOPSIS
Functions/Subroutines subroutine clarnv (IDIST, ISEED, N, X) CLARNV returns a vector of random numbers from a uniform or normal distribution. Function/Subroutine Documentation subroutine clarnv (integerIDIST, integer, dimension( 4 )ISEED, integerN, complex, dimension( * )X) CLARNV returns a vector of random numbers from a uniform or normal distribution. Purpose: CLARNV returns a vector of n random complex numbers from a uniform or normal distribution. Parameters: IDIST IDIST is INTEGER Specifies the distribution of the random numbers: = 1: real and imaginary parts each uniform (0,1) = 2: real and imaginary parts each uniform (-1,1) = 3: real and imaginary parts each normal (0,1) = 4: uniformly distributed on the disc abs(z) < 1 = 5: uniformly distributed on the circle abs(z) = 1 ISEED ISEED is INTEGER array, dimension (4) On entry, the seed of the random number generator; the array elements must be between 0 and 4095, and ISEED(4) must be odd. On exit, the seed is updated. N N is INTEGER The number of random numbers to be generated. X X is COMPLEX array, dimension (N) The generated random numbers. Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: September 2012 Further Details: This routine calls the auxiliary routine SLARUV to generate random real numbers from a uniform (0,1) distribution, in batches of up to 128 using vectorisable code. The Box-Muller method is used to transform numbers from a uniform to a normal distribution. Definition at line 100 of file clarnv.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.2 Tue Sep 25 2012 clarnv.f(3)
All times are GMT -4. The time now is 01:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy