title: How to test strings for lexicographic less than or equal in Bash?
body: <p>In Bash, is there a simple way to test if one string is lexicographically less than or equal to another?</p>
  
  <p>I know you can do:</p>
  
  <pre><code>if [[ "a" &lt; "b" ]]
  </code></pre>
  
  <p>for testing strict inequality, or</p>
  
  <pre><code>if [[ 1 -le 1 ]]
  </code></pre>
  
  <p>for numbers. But <code>-le</code> doesn't seem to work with strings, and using <code>&lt;=</code> gives a syntax error.</p>