Don't Repeat Yourself in Bashrc
·31 words·1 min
A handy way to add a line in bashrc only if it doesn’t exist already:
LINE=“export DISPLAY=localhost:0.0” FILE=~/.bashrc grep -q “$LINE” “$FILE” || echo “$LINE” >> “$FILE” || source ~/.bashrc