-eq does not exist in a double bracket expression, hence the syntax error. Either use (pattern matching)
or (arithmetic comparison expression)
Note that whichenv does not contain the right value (this is not delivered by the head and tail utilities )
Try for example
To get the number behind the dash
--
Quote:
Originally Posted by nezabudka
must be enclosed in double quotes and compare strings.
Your code will work the same way.
Note: the OP was using a double bracket expression, where these quotes are not necessary..
With single brackets the correct expression is either (string comparison):
or (numerical comparison)
Last edited by Scrutinizer; 01-15-2019 at 06:14 PM..
These 3 Users Gave Thanks to Scrutinizer For This Post:
-eq does not exist in a double bracket expression, hence the syntax error. Either use (pattern matching)
or (arithmetic comparison expression)
Note that whichenv does not contain the right value (this is not delivered by the head and tail utilities )
Try for example
To get the number behind the dash
--
Note: the OP was using a double bracket expression, where these quotes are not necessary..
With single brackets the correct expression is either (string comparison):
or (numerical comparison)
Everyday I have to get a list of files in a directory with a special condition and feed this list to a for loop to be processed. Since I do not use Unix all the time, it is tricky for me to get that list of files. So, the question is whether there are commands that will give me the file names... (12 Replies)
I have a unix shell script generate.sh that writes to a file hello.txt using redirect.
For example:echo " Today's report shows progress by: " > hello.txt
This hello.txt is then send as an email body to the recipients.
My requirement is to have this special characters(up arrow and down arrow... (6 Replies)
HI
My doubt may be basic one but I need to get it clarified..
When i use "if" condition that checks for many AND, OR logical conditions
like
if ]; then
return 0
fi
Even the if condition fails it returns as zero.. Any clue..
But if i add else condition like
if ]; ... (2 Replies)
Hi,
I have file
#cat drivers.txt
fcs0
fcs1
vscsi1
vscsi2
In this i need to check the availabality of "fcs" or "vscsi" alone not vscsi0,fcs1
I tried with "if condition" but it is not working.
cat drivers.txt| while read ADAP
do
echo "Checking for $ADAP"
if ;then
echo "FC... (9 Replies)
Hi Friends,
I have an input file like this
chr1 100 200
chr1 200 300
chr1 300 400
chr1 400 500
chr1 500 600
chr1 600 700
chr1 700 800
chr1 800 900
chr1 900 920
chr1 940 960
I would like to get the first line's second column and the fifth line's 3rd column as one single line. This... (13 Replies)
OS Environment: HP-UX B.11.31 U ia64
I am using the shell script code to connect to Oracle RAC database.
Passing the parameter of cluster database name.
typeset -l DB_ID=$1
+ typeset -l DB_ID=sivDB
#---- 3. SetDB validation -------------
if ; then
print... (3 Replies)
I was trying to run a code to check if a fax number is empty or not.
for that, I've written the following code which is throwing an error.
#!/bin/ksh
fax= "999-999-9999"
if ; then
fax_no="000-000-0000"
else
fax_no=$fax
fi
echo $fax_no
And I get the... (7 Replies)