The problem is that within [[ ]] the == does a glob match rather than a string comparison.
In your case a \X in the glob pattern becomes a X and that differs.
Therefore, the right side of the == must be in quotes in order to escape the glob match and become a string match.
is sufficient; of course
looks better.
Compare with
where within [ ] the = always does a string comparison, but, because [ is a command, the shell first does a glob match against the current directory on both sides, and then compares the resulting strings. So both sides of the = must be in quotes.
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)
Is there a way to compare the permission string of two files and output the string if they match?
For ex:
-rw-r--r-- 1 user newuser 0 2009-03-12 16:45 file2
-rw-r--r-- 1 user newuser 0 2009-03-12 16:46 fileone
output:
-rw-r--r--
If they don't match output will be just... (3 Replies)
Hi ,
My requirement is to read from a file into a variable.
I need to check if the variable is equal to string "no rows selected".
The sh script snippet is as follows:
file=/data/lpgtwo/home/nikhilp/TriggerNames.txt
echo $file
var=`cat $file`
echo $var
if
then
echo "No... (3 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)
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 DEBIAN
rfiosetopt
RFIOSETOPT(3) Rfio Library Functions RFIOSETOPT(3)NAME
rfiosetopt - set RFIO options
SYNOPSIS
#include <sys/types.h>
#include "rfio_api.h"
int rfiosetopt (int opt, int *pval, int len)
int rfio_setbufsize (int s, int bufsize)
DESCRIPTION
rfiosetopt sets the RFIO option opt to the content of the memory cell pointed by pval.
rfio_setbufsize sets the size of the readahead buffer to be used on a particular socket connection.
opt can have on of the following values:
RFIO_READOPT
The value pointed by pval can be 0, RFIO_READBUF, RFIO_READAHEAD or RFIO_STREAM (V3).
If set to zero, a normal read will be used (one request to the server per read).
If set to RFIO_READBUF, an internal buffer is allocated in the client API, each call to the server fills this buffer and the
user buffer is filled from the internal buffer. There is one server call per buffer fill.
If set to RFIO_READAHEAD, an initial call is sent to the server which pushes data to the client buffer until end of file is
reached or an error occurs or a new request comes from the client. There is no intermediate buffer unless RFIO_READ-
BUF|RFIO_READAHEAD is specified.
If RFIO_STREAM is set, the V3 protocol is enabled. This uses 2 socket connections between the client and the server and the
server itself is multi-threaded allowing overlap of disk and network operations. The data is pushed on the data socket until
end of file is reached or an error occurs. The transfer can be interrupted by sending a packet on the control socket.
Default is RFIO_READBUF.
The default internal buffer size is 128kB, but the buffer size can be set with an entry RFIO IOBUFSIZE in shift.conf or thru
the environment variable RFIO_IOBUFSIZE.
RFIO_NETOPT
The value pointed by pval can be RFIO_NONET or RFIO_NET. If set to RFIO_NONET, the NET entries in shift.conf are ignored.
Default is RFIO_NET.
RFIO_NETRETRYOPT
The value pointed by pval can be RFIO_RETRYIT or RFIO_NOTIME2RETRY.
If set to RFIO_RETRYIT, there will be retries on failing connect. The number of retries is given by the environment variable
RFIO_CONRETRY or the RFIO CONRETRY entry in shift.conf. The retry interval (in seconds) is given by the environment variable
RFIO_CONRETRYINT or the RFIO CONRETRYINT entry.
If set to RFIO_NOTIME2RETRY, there will be no retry on failing connect.
Default is RFIO_RETRYIT.
RFIO_CONNECTOPT
The value pointed by pval can be RFIO_NOLOCAL or RFIO_FORCELOCAL. If set to RFIO_FORCELOCAL, no parsing is done on pathname.
The file is assumed to be local. Default is RFIO_NOLOCAL.
The len argument is ignored.
s is the file descriptor of the receiving socket.
bufsize is the size of the readahead buffer to be used.
RETURN VALUE
rfiosetopt returns 0 if the operation was successful or -1 if the operation failed. In the latter case, serrno is set appropriately.
ERRORS
ENOMEM buffer could not be allocated.
EINVAL opt is not a valid option, bufsize is negative or the user tries to change the buffer size after the actual I/O has started.
SEE ALSO rfio_open(3), rfioreadopt(3)AUTHOR
LCG Grid Deployment Team
LCG $Date: 2010-02-15 10:01:40 +0100 (Mon, 15 Feb 2010) $ RFIOSETOPT(3)