Sponsored Content
Full Discussion: Check variable
Top Forums Shell Programming and Scripting Check variable Post 302853581 by wisecracker on Sunday 15th of September 2013 11:27:23 AM
Old 09-15-2013
If you are unsure try a simple interactive longhand example first...

On your "if" line which I assume is line 76 there should be a space in the last condition just before "]":-
Code:
............&& [ "$MAPLIST" = "TYPE_YOUR_MATCHSETTINGS" ]; then

Example using OSX 10.7.5 default terminal, bash:-
Code:
Last login: Sun Sep 15 16:03:38 on ttys000
AMIGA:barrywalker~> x="Let it be."
AMIGA:barrywalker~> if [ "$x" == "Let it not be."]; then echo "$x"; else echo "Let it not be."; fi
-bash: [: missing `]'
Let it not be.
AMIGA:barrywalker~> _

Note the space missing before the "]"...

EDIT:
I have a sneaking suspicion your entire "if" condition might still give rise to your error on line 80.

Last edited by wisecracker; 09-15-2013 at 12:33 PM.. Reason: Incorrect indent in example...
This User Gave Thanks to wisecracker For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Check if variable is a number

If I have a variable $X, how do I check it is a number? Many thanks. (2 Replies)
Discussion started by: handak9
2 Replies

2. Shell Programming and Scripting

check for NULL variable

Hello I want to check for NULL variable.. but this is not working..please help thanks in advance esham (2 Replies)
Discussion started by: esham
2 Replies

3. Shell Programming and Scripting

How to check parameter variable?

Hello All, I have a script that will email out if the email address is specified as parameter 1. I am using ksh, and then tried the following : email=$1 Following did not work, I am getting error test -z $email test ${email:=" ") -eq " " test -n $email test ${?email} What... (4 Replies)
Discussion started by: negixx
4 Replies

4. Shell Programming and Scripting

How to check if a variable contains a .

Hi I am writing a bash script and would like to check is a variable contains a . or not ex. a=102 output ok a=1.02 output not ok Many thanks, (3 Replies)
Discussion started by: gekkos
3 Replies

5. Shell Programming and Scripting

check if a variable is not affected

Hi all, to check that a variable is not empty, I usually do: if ; then... or if ; then... what if I have a serie of variables and want to do the same test on all of them. How to do this in a single if statement? thank you (1 Reply)
Discussion started by: melanie_pfefer
1 Replies

6. UNIX for Dummies Questions & Answers

Check the value of a string variable

hi to all, i want to check the value of a variable that it contains characters. for example i try the following: if then ......... i just want to check that in the specific line that is a variable called "passline" has the entry "password". But it can contain also other characters in the... (4 Replies)
Discussion started by: omonoiatis9
4 Replies

7. Shell Programming and Scripting

Check if a variable is zero

I have seen many posts for this sort of problem but I just did not know how to use it for my issue. A number is assigned to a variable and I wanted to check if it is a zero or non zero. Example of my numbers are below: 000000000000000000000000000000000000000000000000... (8 Replies)
Discussion started by: soujiv
8 Replies

8. Shell Programming and Scripting

Check the value of a variable

#!/bin/sh echo "Running Script to capture ORACLE Erros" # Change Directory to the actual logs path cd /home/nv8510/lognew err_var=`grep -in "ORA-" *` if then echo "THESE ARE THE ORACLE ERROR OCCURED" echo "$err_var" echo... (7 Replies)
Discussion started by: neeraj617
7 Replies

9. Shell Programming and Scripting

Check if a variable is having value

I have a script /root/asas with following contents. #!/bin/bash ha=`cat /etc/passwd | grep sandra` if ; then echo "Sandra is in /etc/passwd" echo "variable ha is $ha" else echo "Sandra is NOT in /etc/passwd" echo "variable ha is $ha" fi What... (3 Replies)
Discussion started by: anil510
3 Replies

10. Shell Programming and Scripting

How to check whether a variable is empty or contains some value?

hi, i want to check whether a a variable contains some value or is empty in a shell script. so if the variable contains some value i want to do some job and if the variable doesnt contain any value then i need to skip that job. here is a sample script read_filenames.sh contains ... (5 Replies)
Discussion started by: Little
5 Replies
APPLY(1)						    BSD General Commands Manual 						  APPLY(1)

NAME
apply -- apply a command to a set of arguments SYNOPSIS
apply [-a c] [-d] [-#] command argument ... DESCRIPTION
The apply utility runs the named command on each argument argument in turn. Character sequences of the form ``%d'' in command, where 'd' is a digit from 1 to 9, are replaced by the d'th following unused argument. In this case, the largest digit number of arguments are discarded for each execution of command. The options are as follows: -# Normally arguments are taken singly; the optional number -# specifies the number of arguments to be passed to command. If the number is zero, command is run, without arguments, once for each argument. If any sequences of ``%d'' occur in command, the -# option is ignored. -a c The use of the character '%' as a magic character may be changed with the -a option. -d Display the commands that would have been executed, but do not actually execute them. ENVIRONMENT
The following environment variable affects the execution of apply: SHELL Pathname of shell to use. If this variable is not defined, the Bourne shell is used. EXAMPLES
apply echo a* is similar to ls(1); apply -2 cmp a1 b1 a2 b2 a3 b3 compares the `a' files to the `b' files; apply -0 who 1 2 3 4 5 runs who(1) 5 times; and apply 'ln %1 /usr/joe' * links all files in the current directory to the directory /usr/joe. FILES
/bin/sh default shell AUTHORS
Rob Pike BUGS
Shell metacharacters in command may have bizarre effects; it is best to enclose complicated commands in single quotes (''). HISTORY
The apply command appeared in 4.2BSD. BSD
April 4, 1994 BSD
All times are GMT -4. The time now is 07:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy