LinuxQuestions.org
Review your favorite Linux distribution.
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,320

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635

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: 19,028

Rep: Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890
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,426

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 11:23 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration