Skip to content
Snippets Groups Projects
Unverified Commit 2c8601d4 authored by Nagy Tibor's avatar Nagy Tibor Committed by GitHub
Browse files

Fix string comparisons in documentation

The builtin test command expects `=` for string comparisons, not `-eq`
parent fffdddcd
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ builtin, which may be convenient to use in conjuction with other commands in ord ...@@ -24,7 +24,7 @@ builtin, which may be convenient to use in conjuction with other commands in ord
the exit status; and a `matches` builtin that performs a regex-based boolean match. the exit status; and a `matches` builtin that performs a regex-based boolean match.
```sh ```sh
if test "foo" -eq $foo if test "foo" = $foo
echo "Found foo" echo "Found foo"
else if matches $foo '[A-Ma-m]\w+' else if matches $foo '[A-Ma-m]\w+'
echo "we found a word that starts with A-M" echo "we found a word that starts with A-M"
...@@ -72,7 +72,7 @@ can be skipped over and conditionally-executed based on return status. This enab ...@@ -72,7 +72,7 @@ can be skipped over and conditionally-executed based on return status. This enab
expressing some patterns better than could be done with an if statement. expressing some patterns better than could be done with an if statement.
```ion ```ion
if test $foo -eq "foo" && test $bar -eq "bar" if test $foo = "foo" && test $bar = "bar"
echo "foobar was found" echo "foobar was found"
else else
echo "either foo or bar was not found" echo "either foo or bar was not found"
...@@ -80,7 +80,7 @@ end ...@@ -80,7 +80,7 @@ end
``` ```
```ion ```ion
test $foo -eq "foo" && test $bar -eq "bar" && test $foo = "foo" && test $bar = "bar" &&
echo "foobar was found" || echo "foobar was found" ||
echo "either foo or bar was not found" echo "either foo or bar was not found"
``` ```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment