From 2c4b797b42c625cb9e36f7efc326299fc59f27e3 Mon Sep 17 00:00:00 2001 From: zeus Date: Mon, 31 Aug 2020 13:45:34 +0200 Subject: [PATCH] falsefriends --- falsefriends.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 falsefriends.md diff --git a/falsefriends.md b/falsefriends.md new file mode 100644 index 0000000..d2191d3 --- /dev/null +++ b/falsefriends.md @@ -0,0 +1,11 @@ +False friends +--- +Bash and CLI-tools waiting to shoot you from behind + +PATH +-- +an empty string in `$PATH` is equivalent to `.`, so prepending `:` to your PATH, effectively includes the CWD into the PATH, giving it priority over everything else in the PATH, which is incredibly dangerous. + +killall -1 +-- +in `killall` tha parameter `-1` is - differnently to `kill` NOT interpreted as signal, but is a special variable for "applies to everything except PID1 and kill itself". Therefore no signal is given, and the default one (15, SIGTERM) will be applied to each and every PID (but is then usually reduced again to the searchterm given). So `killall -1 java` does in pseudocode effectively: `where name is java; do [ ! PID == 1 ] && kill -s 15 $name; done` ...very dangerous