‘\r’: command not found – .bashrc / .bash_profile [duplicate]

When all else fails in Cygwin… Try running the dos2unix command on the file in question. It might help when you see error messages like this: -bash: ‘\r’: command not found Windows style newline characters can cause issues in Cygwin. The dos2unix command modifies newline characters so they are Unix / Cygwin compatible. CAUTION: the dos2unix command modifies files in place, … Read more

How to mkdir only if a directory does not already exist?

Try mkdir -p: Note that this will also create any intermediate directories that don’t exist; for instance, will create directories foo, foo/bar, and foo/bar/baz if they don’t exist. Some implementation like GNU mkdir include mkdir –parents as a more readable alias, but this is not specified in POSIX/Single Unix Specification and not available on many common platforms like macOS, various BSDs, and various commercial … Read more

‘\r’: command not found – .bashrc / .bash_profile [duplicate]

When all else fails in Cygwin… Try running the dos2unix command on the file in question. It might help when you see error messages like this: -bash: ‘\r’: command not found Windows style newline characters can cause issues in Cygwin. The dos2unix command modifies newline characters so they are Unix / Cygwin compatible. CAUTION: the dos2unix command modifies files in place, … Read more

Multi-line string with extra space (preserved indentation)

Heredoc sounds more convenient for this purpose. It is used to send multiple commands to a command interpreter program like ex or cat The string after << indicates where to stop. To send these lines to a file, use: You could also store these lines to a variable: This stores the lines to the variable named VAR. When printing, remember the … Read more