Updated SC2000 (markdown)

Christopher Slycord
2020-05-06 19:18:14 +09:00
parent 9d34c3a39e
commit e932d0853c

@@ -1,5 +1,10 @@
# See if you can use ${#variable} instead
`${#variable}` will be equal to the number of characters in `"${variable}"`
This is the same result as `"$( echo "$variable" | wc -m )"`
When "$variable" only contains single-byte characters, it's also the same as `"$( echo "$variable" | wc -c )"`
## example code
``` bash
@@ -8,4 +13,8 @@
if [ "$( echo "$1" | wc -c )" -gt 1 ]; then
echo "greater than 1"
fi
if [ "$( echo "$1" | wc -m )" -gt 1 ]; then
echo "greater than 1"
fi
```