Results for “Limits & process security”
Small, practical examples. Search by task or narrow things down below.
Bound a command execution time
Linux Commands: Use timeout and handle status 124 as an expected time limit.
Linux Commands✓ Tested
Change directory only for one operation
Bash Scripts: A subshell makes a temporary directory change without affecting later commands.
Bash Scripts✓ Tested
Collect two independent background results
Bash Scripts: Write each job’s output separately and wait for both before combining results.
Bash Scripts✓ Tested
Compare two generated sorted streams
Bash Scripts: Process substitution lets a command consume another command’s output as a file-like input.
Bash Scripts✓ Tested
Convert a Unix timestamp to UTC
Linux Commands: Use the @ syntax with GNU date for seconds since the Unix epoch.
Linux Commands✓ Tested
Copy a file with explicit permissions
Linux Commands: Use install to create parent directories and set the destination mode in one operation.
Linux Commands✓ Tested
Format a known UTC timestamp
Linux Commands: Use GNU date -u and an explicit input offset to avoid local timezone dependence.
Linux Commands✓ Tested
Format a zero-padded numeric label
Linux Commands: Use printf formatting instead of concatenating a variable number of zeroes.
Linux Commands✓ Tested
Generate a stepped sequence
Linux Commands: Use seq when a command pipeline needs a numeric sequence.
Linux Commands✓ Tested
Handle a nonzero background-job exit
Bash Scripts: Wait reports a child’s exit code; put it in a conditional when failure is expected.
Bash Scripts✓ Tested
Keep loop state by avoiding a pipeline subshell
Bash Scripts: Redirect input into a while loop so updates to a counter remain in the current shell.
Bash Scripts✓ Tested
Pass a variable to one command
Linux Commands: Use env to supply a child process value without setting it permanently in the parent shell.
Linux Commands✓ Tested