First things first: A string with spaces is enclosed in either single quotes ‘ or double quotes “. The difference you ask? Single quotes are treated “as is”: No variable replacement, no parsing, just a string. If you want to embed a variable value, you have to concatenate the string. Period. Double quotes allow dynamic… Continue reading Escaping in shells
Author: Andreas Gottardi
Check if remote database exists
Escaping in PowerShell or in any other scripting language is not that much fun to begin with. So if you have quotes in quotes on different shells in different systems it becomes really funny. So trust me, I am more than surprised that I just found a neat way to check, if a database exists… Continue reading Check if remote database exists
Unify line endings
Let’s assume you have a software project and the line endings of the files are inconsistent. Meaning, that git commits and pushes without proper configuration will result in a merge disaster because the merge tools recognize the whole file as changed and not just the lines actually changed. When working on Windows or on a… Continue reading Unify line endings
How to keep a clean local development environment
As a developer I have to work with a lot of tools, development environments and frameworks and I want to keep them in the same spot, know what I work with, especially with which version, keep old versions for compatibility reasons and have a simple way of updating stuff without the need to change a… Continue reading How to keep a clean local development environment
Archive, compress and send
You want to archive (tar), compress (gzip) and send (scp) a directory in one command? With Linux, it is possible: What does it do? tar cf – yourdir creates a uncompressed archive and writes it to standard out (stdout). gzip -9 -c reads from standard in (stdin), compresses and writes to standard out. ssh -l… Continue reading Archive, compress and send
Send passwords more secure
Sometimes it is inevitable to send passwords and credentials to a counterpart who needs access to some kind of management tool because there is not extended and secure user management available. I always just sent the credentials with the login link. Now imagine what this means: A potential scanner or crawler could find my the… Continue reading Send passwords more secure
Example for automating a time consuming manual process
My recent entries were quite technical and were meant to solve very specific problems or show how to overcome certain issues on the last mile that are very annoying in a per se well defined concept. Today I’d like to give a overview from a higher level to put my other posts into perspective. The… Continue reading Example for automating a time consuming manual process
Zabbix agent deployment and configuration
Installation and configuration of the Zabbix agent, the counterpart of the Zabbix server, that collects and sends data to the server to be shown, is quite easy and can be done with a simple bash script. Now let’s imagine you have 1000 hosts and would have to do that on each and every one of… Continue reading Zabbix agent deployment and configuration
Parse JSON output from an API with Python
As great as PowerShell is with JSON objects you can’t always use it because it is not available on each and every machine with Linux out there. And I don’t know a way of parsing JSON code with plain bash properly. Fortunately a lot of servers come with “python” installed and it can be used… Continue reading Parse JSON output from an API with Python
Redirecting with mod_rewrite
Assume you have a shiny new site with great content, a new URL (or http address) and are expecting customers. Unfortunately your old site is not yet really gone in the search results but luckily you still have access to your old address. There is an easy way to redirect the users, who click on… Continue reading Redirecting with mod_rewrite