From 2c8601d45fe7a39a30cd320e1b7f28657f97aa1c Mon Sep 17 00:00:00 2001 From: Nagy Tibor <xnagytibor@gmail.com> Date: Sat, 4 Nov 2017 18:02:21 +0100 Subject: [PATCH] Fix string comparisons in documentation The builtin test command expects `=` for string comparisons, not `-eq` --- manual/src/ch07-01-conditionals.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manual/src/ch07-01-conditionals.md b/manual/src/ch07-01-conditionals.md index 75278dc3..8a2f608a 100644 --- a/manual/src/ch07-01-conditionals.md +++ b/manual/src/ch07-01-conditionals.md @@ -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. ```sh -if test "foo" -eq $foo +if test "foo" = $foo echo "Found foo" else if matches $foo '[A-Ma-m]\w+' 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 expressing some patterns better than could be done with an if statement. ```ion -if test $foo -eq "foo" && test $bar -eq "bar" +if test $foo = "foo" && test $bar = "bar" echo "foobar was found" else echo "either foo or bar was not found" @@ -80,7 +80,7 @@ end ``` ```ion -test $foo -eq "foo" && test $bar -eq "bar" && +test $foo = "foo" && test $bar = "bar" && echo "foobar was found" || echo "either foo or bar was not found" ``` -- GitLab