~/devreads

#bash

9 posts

30 Mar

Jenn Randall 3 min read

Let’s say you install a tool. Maybe it’s Node, or maybe it’s a CLI for a project you just cloned. The installer runs successfully. Then you open your terminal and type: node And your shell responds: zsh: command not found: node A completely normal reaction to seeing “command not found.” At some point, most of […] The post What the…

development practicesbashshell

20 Apr 2020

6 Feb 2020

16 May 2019

3 min read

Suppose you have a text file and you need to remove all of its duplicate lines. TL;DR To remove the duplicate lines preserving their order in the file use: awk '!visited[$0]++' your_file > deduplicated_file How it works The script keeps an associative array with indices equal to the unique lines of the file and values equal to their occurrences. For…

linuxbashscriptsfileawk

10 Apr 2019

17 Dec 2018

5 May 2018

8 Jul 2017

Nikita Sobolev 7 min read

Some time ago I was faced with a task of testing a bash script. At first I decided to use Python unit-tests, however, I was reluctant to bring external technologies to the project. Therefore I had to go with the testing framework written in the notorious bash. Overview of the existing solutions After googling available solutions, I was presented with…

programmingbashtestingsoftware-developmentadministration

15 Aug 2016