Updated SC3012 (markdown)

Eisuke Kawashima
2025-07-29 10:20:20 +09:00
parent e51141aa0d
commit 3fdacebc05

@@ -18,11 +18,11 @@ First, make sure you wanted a lexicographical comparison (aka dictionary order),
Then to compare as string, you can use `expr` and make sure that the strings are not interpreted numerically by adding some non-numerical data to them. Here, an apostrophe is prepended: Then to compare as string, you can use `expr` and make sure that the strings are not interpreted numerically by adding some non-numerical data to them. Here, an apostrophe is prepended:
``` ```sh
#!/bin/sh #!/bin/sh
x="aardvark" x="aardvark"
y="zebra" y="zebra"
if expr "'$x" \< "'$y" > /dev/null if expr "'$x" \< "'$y" > /dev/null
then then
echo "$x comes before $y in the dictionary" echo "$x comes before $y in the dictionary"
fi fi