Bash: difference between cat and echo?

This is file.txt: foo:bar:baz:qux:quux one:two:tree:four:five:six:seven alpha:beta:gamma:delta:epsilon:zeta:eta:tet...

How to check if a variable is set in Bash??

How do I know if a variable is set in Bash? For example, how do I check if the user gave the first parameter to a f...

What does 'echo 0 > foo' mean??

I would like to know what does this code mean? echo 0 > foo Completely new to Unix and Bash commands. Lots of ...

Remove a fixed prefix/suffix from a string in Bash?

In my bash script I have a string and its prefix/suffix. I need to remove the prefix/suffix from the original string...

Using the RUN instruction in a Dockerfile with 'source' does not work?

I have a Dockerfile that I am putting together to install a vanilla python environment (into which I will be install...

Extract substring using regexp in plain bash?

I'm trying to extract the time from a string using bash, and I'm having a hard time figuring it out. My string is l...

Why can't Git Bash run my executable??

I am on git-for-windows Git Bash. I can't run an executable on the command line: [email protected] MINGW64 /c/dev $ ls s...

choosing between $0 and BASH_SOURCE?

How does one choose between "$0" and "${BASH_SOURCE[0]}" This description from GNU didn't help me much. BASH_S...

How to count lines in a document??

I have lines like these, and I want to know how many lines I actually have... 09:16:39 AM all 2.00 0.00 4...

“unary operator expected” error in Bash if condition?

I've been trying to figure out whats wrong with this but just can't figure it out.. This is the part seems to be ge...

Bash ignoring error for a particular command?

I am using following options set -o pipefail set -e In bash script to stop execution on error. I have ~100 lines ...

Retrieving multiple arguments for a single option using getopts in Bash?

I need help with getopts. I created a Bash script which looks like this when run: $ foo.sh -i env -d directory -s ...

How to reload .bash_profile from the command line??

How can I reload .bash_profile from the command line? I can get the shell to recognize changes to .bash_prof...