Results for “CTE”
Small, practical examples. Search by task or narrow things down below.
Handle an expected command failure
Branch on a command’s exit code without aborting the script.
exit status✓ Tested
Handle an expected terminating error
PowerShell: Handle an expected terminating error using PowerShell 7.
PowerShell✓ Tested
Identify the selected submit action
HTML: Each submit button can supply its own named value for the same form.
HTML✓ Tested
Increment a counter without an unexpected errexit
Bash Scripts: An assignment avoids the zero-result exit status of a standalone arithmetic post-increment.
Bash Scripts✓ Tested
Join array items with a one-character separator
Bash Scripts: A local IFS controls the separator used by the quoted star expansion.
Bash Scripts✓ Tested
Keep both matching and rejected values
JavaScript: Use two explicit outputs when a caller needs both sides of a classification.
JavaScript✓ Tested
Keep both matching and rejected values
TypeScript: Use two explicit outputs when a caller needs both sides of a classification.
TypeScript✓ Tested
Measure UTF-8 bytes separately from characters
Java: Encode a Java string before measuring its serialized byte length.
Java✓ Tested
Name an intermediate query with a CTE
Make a filtered result reusable within one statement.
CTE✓ Tested
Print a selected range of lines
Linux Commands: Use sed -n with a line address to suppress other output.
Linux Commands✓ Tested
Print a single character
Arduino / C: Print a single character on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Print text containing percent characters literally
Bash Scripts: Never use untrusted text as the printf format string.
Bash Scripts✓ Tested