scottobear: (Default)
scott von berg ([personal profile] scottobear) wrote2015-03-13 07:57 am
Entry tags:

Bash nono.

`export EDITOR=$(which rm)`

$( ) is a bash-ism (Command Substitution ) which says, “Execute the command within the parenthesis, and replace the command with the output”.

In this case, it executes the which rm command, that returns the full path to where the rm utility is. Then it sets the EDITOR environment variable to that.

The end result is, when you call a utility which uses the EDITOR variable (visudo, vipw, etc), you delete the file you’re trying to edit.

Originally published at The Scotto Grotto. You can comment here or there.