summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-03-08 14:23:50 -0600
committerCase Duckworth2023-03-08 14:23:50 -0600
commitc7f4ecf9c261ce09c4e8ddc0185505f551cf49a4 (patch)
treeb8bfd83ac004688cea5058d05a3746e3eb3b8294
parentFix arithmetic error in scroll causing crash (diff)
downloadvellum-c7f4ecf9c261ce09c4e8ddc0185505f551cf49a4.tar.gz
vellum-c7f4ecf9c261ce09c4e8ddc0185505f551cf49a4.zip
Correctly quote to catch whitespace characters HEAD main
-rwxr-xr-xvellum6
1 files changed, 3 insertions, 3 deletions
diff --git a/vellum b/vellum index 8cd03c2..5058b34 100755 --- a/vellum +++ b/vellum
@@ -1,4 +1,4 @@
1set +x 1# make sure to put a shebang here
2 2
3readc() { # arg: <variable-name> 3readc() { # arg: <variable-name>
4 # adapted from https://unix.stackexchange.com/a/464963 4 # adapted from https://unix.stackexchange.com/a/464963
@@ -30,10 +30,10 @@ readc() { # arg: <variable-name>
30 # Break on EOF 30 # Break on EOF
31 test -n "$c" || break 31 test -n "$c" || break
32 32
33 eval "$var=\${$var}$c" 33 eval "$var=\"\${$var}$c\""
34 34
35 # Break when we have a full character (wc -m) 35 # Break when we have a full character (wc -m)
36 test "$(eval printf %s "\$$var" | wc -m)" -eq 0 || break 36 test "$(eval printf %s "\"\$$var\"" | wc -m)" -eq 0 || break
37 done 37 done
38 38
39 # Round-trip sanitized variables 39 # Round-trip sanitized variables