Bash / Shell
Strings
Extract a substring
output=""
output=""
Replace the first match of $substring
with $replacement
output=""
Replace all the matches of $substring
with $replacement
output=""
Remove shortest match of $substring
from front of $input
output=""
Remove longest match of $substring
from front of $input
output=""
Remove shortest match of $substring
from back of $input
output=""
Remove longest match of $substring
from back of $input
output=""
Remove leading white space (left trim)
output=""
Remove trailing white space (right trim)
output=""
Files
Check if a regular file exists
File test operators
Expression | What does it check? |
---|---|
-e | If file exists |
-f | If file exists and is a regular file |
-d | If file exists and is a directory |
-r | If file exists and is readable |
-w | If file exists and is writable |
-x | If file exists and is executable |
-s | If file exists and its size is greater than zero |
Remove filename extension
output=""
Logging
Merge and log stdout
and stderr
in a file:
|
Unbuffered version:
|