LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-28-2019, 09:37 PM   #16
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783

this will explain it


https://mywiki.wooledge.org/BashGuid..._and_.5B.5B.29

Quote:
Note that the comparison operators =, !=, >, and < treat their arguments as strings.
In order for the operands to be treated as numbers, you need to use one of a different
set of operators: -eq, -ne (not equal), -lt (less than), -gt, -le (less than or equal to),
or -ge.
Pop quiz: Come up with an example that shows the difference between < and -lt.
Cue Jeopardy music...
Since "314" comes before "9" lexicographically (i.e. the order that the dictionary would put them in),
[ considers the former to be < than the later;
whereas, [ considers "314" NOT to be -lt "9",
because three hundred fourteen is NOT less than nine.
 
Old 09-28-2019, 10:03 PM   #17
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
It is all about syntax and the difference between single brackets [ ], double brackets [[ ]] and double parentheses (( )) as explained in the link.
 
Old 09-29-2019, 06:04 AM   #18
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Original Poster
Rep: Reputation: 100Reputation: 100
Ok, thanks again !
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forum related question - Please help with specific search technique Jongi LQ Suggestions & Feedback 8 01-05-2006 11:07 AM
A question related to DVD burning technique babyboss Linux - Hardware 8 08-15-2005 04:19 AM
Back up technique for one-time re-install rickh Fedora 3 07-07-2005 04:49 PM
Symlink or Mount or Another Technique? jalperin Linux - Newbie 1 08-26-2004 06:43 PM
Advanced GREP technique ? ganninu Linux - General 2 10-08-2003 06:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration