FIND YOUR NEXT FEW LINES

Results for “script”

Small, practical examples. Search by task or narrow things down below.

407 snippets foundClear filters
Bash ScriptsInput streams & redirection

Write a literal multiline block

Bash Scripts: Quoting the heredoc delimiter disables parameter and command expansion inside it.

Bash Scripts✓ Tested
JavaScriptFiles & async

Write a UTF-8 file

Use the built-in Node.js filesystem API to save text.

JavaScript✓ Tested
Bash ScriptsGetting Started

Write several literal lines

Bash Scripts: Write several literal lines with a small standalone Bash program.

Bash Scripts✓ Tested
TypeScriptUtilities & async

Await several independent results

Preserve input order while awaiting multiple promises.

Promise.all✓ Tested
Bash ScriptsFiles & reliability

Check that a file is present and nonempty

Test file content availability before reading it.

file check✓ Tested
Bash ScriptsLoops & decisions

Check whether input is a nonnegative integer

Reject empty input and nonnumeric characters before arithmetic.

validation✓ Tested
Bash ScriptsFiles & reliability

Clean up a temporary directory automatically

Use an EXIT trap so temporary files are removed when the script ends.

mktemp✓ Tested
GitCommits & history

Commit a staged change

Save a focused revision with a descriptive message.

commit✓ Tested
Bash ScriptsVariables & text

Convert a string to lowercase

Normalize a text value using Bash expansion.

lowercase✓ Tested
TypeScriptCollections & records

Count words using a Map

Update a keyed counter without losing its value type.

Map✓ Tested
HTMLData & disclosure

Create a native disclosure

Use details and summary to show optional HTML content without JavaScript.

HTML✓ Tested
GitRemotes & collaboration

Create an annotated release tag

Mark a revision with a readable release description.

tag✓ Tested