FIND YOUR NEXT FEW LINES

Results for “Bash Scripts”

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

379 snippets foundClear filters
Bash ScriptsVariables & text

Replace every occurrence in a string

Substitute text directly with Bash parameter expansion.

replace✓ Tested
Bash ScriptsFunctions & arguments

Return text from a shell function

Capture a function’s output with command substitution.

function✓ Tested
Bash ScriptsVariables & text

Split a line into named fields

Read a simple delimiter-separated line into variables.

read✓ Tested
Bash ScriptsLoops & decisions

Sum a range of integers

Use an arithmetic loop without launching external processes.

arithmetic✓ Tested
Bash ScriptsVariables & text

Use a default value for an unset variable

Supply a fallback without changing the original variable.

parameter expansion✓ Tested
HTMLImages & embedded documents

Allow embedded scripts without granting same-origin access

HTML: Grant only allow-scripts so the sandboxed document retains an opaque origin.

HTML✓ Tested
HTMLImages & embedded documents

Block scripts in an embedded document

HTML: An empty sandbox attribute applies the default set of restrictions, including blocking script execution.

HTML✓ Tested
Docker / ComposeDockerfile patterns

Choose Bash with pipefail for build commands

Docker / Compose: SHELL changes the interpreter for subsequent shell-form instructions.

Docker / Compose✓ Tested
HTMLText semantics

Write subscripts and superscripts in ordinary text

HTML: Sub and sup position short annotations such as formula indices and exponents.

HTML✓ Tested
GitMerging & replaying changes

Abort a conflicting cherry-pick

Git: Abort removes the incomplete replay and returns to the previous branch state.

Git✓ Tested
GitMerging & replaying changes

Abort a conflicting rebase

Git: Abort returns the branch to its state before the rebase attempt.

Git✓ Tested
GitMerging & replaying changes

Abort a merge with unresolved conflicts

Git: Abort restores the pre-merge state in this clean practice repository.

Git✓ Tested