Bash terminal
Bash

How to encrypt and decrypt text in bash

Sometimes you need to encrypt a text string or a whole file because it is not recommended (or desirable) to use it as is. What to do if you see yourself in this situation? Make use of the openssl command. The openssl program is a command line tool for using the various cryptography functions of OpenSSL’s crypto library from the…

Continue Reading

Bash terminal
Bash

Bash: echo ignores here-documents

Well, not quite. I mean, if you are trying to use here-documents with the echo command in bash and it seems you are getting an empty line instead, the issue might be that echo is displaying only the first line, and it turns out to be an empty one. Consider the following example: $ echo < this is not >…

Continue Reading

Bash Session
Bash

Bash: spaces turn into newlines on for loops

Have you ever tried to loop through a set of items in a for loop in bash just to discover that bash turns spaces into newlines making your script to break? Well, if you are in a hurry, use this before starting the for loop and come back afterwards for an explanation of what happened there: export IFS=$’\n’; Your final result might look like…

Continue Reading