Just trying to compare the following variables as a condition in an 'if' statement.
The problem I'm getting is that the condition always comes out true and doesn't appear to compare them properly. If I use the 'ne' operator I get an error.
(All I actually want to know is if the string DATA contains the substring '0 b (0%)' and use that in the 'if' statement but I just want to get the match for now to simplify the problem.)
Is anyone able to tell me why these would not compare correctly?
Hi all,
I have a file like this
ibhib=ere
wefwfl=werfe
sfdes=wef
From this file, i need to get the lefthand side string with respect to the corresponding righthand side string. i.e, I need to get the string "ere" with respect to "ibhib".
But i am stuck with how to compare a string... (1 Reply)
Hi Guys
i need to write a script to check the file structure
I have added the the file headers in the configuration file and execute the file at the start of the script.
Now the function
checkFileStructure()
{
echo "Inside the function"
filetocheck=$1
fileheader=$2
if ]
then... (1 Reply)
I'm running the following script to compare string values to a regexp:
for entry in $(lpinfo -v | cut -c 1-); do
if
then
echo "blah"
continue
fi
done
Whenever I run it, each token of lpinfo is being interpreted as a command and I get errors such as:
... (2 Replies)
Hi,
I have the below logic. Here 'X' is a variable having some string.
if
then
echo "i dont need to go to ofc"
else
echo "i need to go to ofc"
Please help me to write it in unix.
Thanks. (2 Replies)
#!/bin/sh
PRINTF=/usr/bin/printf
MACHINE_NAME=`uname -n`
TIME=`date +"%H"`
$PRINTF "Welcome to $MACHINE_NAME. What is your name?\n"
read NAME
if ; then
$PRINTF "Good morning $NAME, how are you?\n"
elif ; then
$PRINTF "Good afternoon $NAME, how are you?\n"
else
$PRINTF "Good... (2 Replies)
Hi,
We are using AIX and while using KSH Unix script, we are reading data in a file and then using the if statement for comparison. The code with if statement is as follows;
cat $FILETMP | while read a
do
jobstr1=`echo $a | awk '{print $1}'`
var1=`echo $jobstr1 | cut -c... (3 Replies)
continuing from my previous post, whose link is given below as a reference
https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569
consider there is create table commands in a file for eg:
CREATE TABLE `Blahblahblah` (
`id` int(11) NOT NULL... (2 Replies)
attempting the hangman program. This was an optional assignment from the professor. I have completed the logical coding, debugging now.
##I have an array $wordString that initializes to a string of dashes
##reflecting the number of letters in $theWord
##every time the user enters a (valid)... (5 Replies)
I have the logic below to look up for matches within the columns between the two files with awk.
In the if statement is where the string comparison is attempted with ==
The issue seems to be with the operands, as
1. when " '${SECTOR}' " -- double quote followed by single quote -- awk matches... (1 Reply)
Discussion started by: deadyetagain
1 Replies
LEARN ABOUT OPENDARWIN
ldap_compare_s
LDAP_COMPARE(3) Library Functions Manual LDAP_COMPARE(3)NAME
ldap_compare, ldap_compare_s, ldap_compare_ext, ldap_compare_ext_s - Perform an LDAP compare operation.
LIBRARY
OpenLDAP LDAP (libldap, -lldap)
SYNOPSIS
#include <ldap.h>
int ldap_compare_ext(
LDAP *ld,
char *dn,
char *attr,
const struct berval *bvalue,
LDAPControl **serverctrls,
LDAPControl **clientctrls,
int *msgidp );
int ldap_compare_ext_s(
LDAP *ld,
char *dn,
char *attr,
const struct berval *bvalue,
LDAPControl **serverctrls,
LDAPControl **clientctrls );
DESCRIPTION
The ldap_compare_ext_s() routine is used to perform an LDAP compare operation synchronously. It takes dn, the DN of the entry upon which
to perform the compare, and attr and value, the attribute description and value to compare to those found in the entry. It returns a code,
which will be LDAP_COMPARE_TRUE if the entry contains the attribute value and LDAP_COMPARE_FALSE if it does not. Otherwise, an error code
is returned that indicates the nature of the problem. See ldap(3) for details.
The ldap_compare_ext() routine is used to perform an LDAP compare operation asynchronously. It takes the same parameters as ldap_com-
pare_ext_s(), but provides the message id of the request it initiated in the integer pointed to msgidp. The result of the compare can be
obtained by a subsequent call to ldap_result(3).
Both routines allow server and client controls to be specified to extend the compare request.
DEPRECATED INTERFACES
The routines ldap_compare() and ldap_compare_s() are deprecated in favor of ldap_compare_ext() and ldap_compare_ext_s(), respectively.
Deprecated interfaces generally remain in the library. The macro LDAP_DEPRECATED can be defined to a non-zero value (e.g., -DLDAP_DEPRE-
CATED=1) when compiling program designed to use deprecated interfaces. It is recommended that developers writing new programs, or updating
old programs, avoid use of deprecated interfaces. Over time, it is expected that documentation (and, eventually, support) for deprecated
interfaces to be eliminated.
SEE ALSO ldap(3), ldap_error(3)ACKNOWLEDGEMENTS
OpenLDAP Software is developed and maintained by The OpenLDAP Project <http://www.openldap.org/>. OpenLDAP Software is derived from the
University of Michigan LDAP 3.3 Release.
OpenLDAP 2017/06/01 LDAP_COMPARE(3)