-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: Use %b in generated printf statements (vs %s)
%b is a posix printf standard, so this should just be an improvement, correcting behavior for shells like DASH. Adds new function, escape_string, which creates a string compatible with %b
- Loading branch information
Showing
12 changed files
with
78 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
printf "%b\n" '$Hello' | ||
printf "%b\n" '<$Hello' | ||
printf "%b%b\n" '<' '%$Hello' | ||
printf "%b%b\n" '<' '<$Hello' | ||
printf "%b\n" '%$Hello' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$Hello | ||
<$Hello | ||
<%$Hello | ||
<<$Hello | ||
%$Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$Hello | ||
<$Hello | ||
<%$Hello | ||
<<$Hello | ||
%$Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
printf "%b\n" '\tHello' | ||
printf "%b\n" '<\tHello' | ||
printf "%b%b\n" '<' '%\tHello' | ||
printf "%b%b\n" '<' '<\tHello' | ||
printf "%b\n" '%\tHello' | ||
printf "%b\n" '\\tHello' | ||
printf "%b\n" '<\\tHello' | ||
printf "%b%b\n" '<' '%\\tHello' | ||
printf "%b%b\n" '<' '<\\tHello' | ||
printf "%b\n" '%\\tHello' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Hello | ||
< Hello | ||
<% Hello | ||
<< Hello | ||
% Hello | ||
\tHello | ||
<\tHello | ||
<%\tHello | ||
<<\tHello | ||
%\tHello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
printf "%b\n" '\0047Hello' | ||
printf "%b\n" '<\0047Hello' | ||
printf "%b%b\n" '<' '%\0047Hello' | ||
printf "%b%b\n" '<' '<\0047Hello' | ||
printf "%b\n" '%\0047Hello' | ||
printf "%b\n" '"Hello' | ||
printf "%b\n" '<"Hello' | ||
printf "%b%b\n" '<' '%"Hello' | ||
printf "%b%b\n" '<' '<"Hello' | ||
printf "%b\n" '%"Hello' | ||
printf "%b\n" 'Hello \0047World\0047' | ||
printf "%b\n" 'Hello "World"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'Hello | ||
<'Hello | ||
<%'Hello | ||
<<'Hello | ||
%'Hello | ||
"Hello | ||
<"Hello | ||
<%"Hello | ||
<<"Hello | ||
%"Hello | ||
Hello 'World' | ||
Hello "World" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'Hello | ||
<'Hello | ||
<%'Hello | ||
<<'Hello | ||
%'Hello | ||
"Hello | ||
<"Hello | ||
<%"Hello | ||
<<"Hello | ||
%"Hello | ||
Hello 'World' | ||
Hello "World" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
printf "%b\n" '\tHello' | ||
printf "%b\n" '<\tHello' | ||
printf "%b%b\n" '<' '%\tHello' | ||
printf "%b%b\n" '<' '<\tHello' | ||
echo Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Hello | ||
< Hello | ||
<% Hello | ||
<< Hello | ||
% echo Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Hello | ||
< Hello | ||
<% Hello | ||
<< Hello | ||
Hello |