Răsfoiți Sursa

add bashrc.d

Mike Ramthun 3 săptămâni în urmă
părinte
comite
fb3fba5cd4
1 a modificat fișierele cu 23 adăugiri și 0 ștergeri
  1. 23 0
      01-bashrc.d.sh

+ 23 - 0
01-bashrc.d.sh

@@ -0,0 +1,23 @@
+#!/bin/env bash
+
+set -e
+
+mkdir -p "$HOME/.bashrc.d"
+
+FILE="$HOME/.bashrc"
+
+BLOCK='
+if [ -d ~/.bashrc.d ]; then
+	for rc in ~/.bashrc.d/*; do
+		if [ -f "$rc" ]; then
+			. "$rc"
+		fi
+	done
+fi
+'
+
+if ! grep -Fqs ".bashrc.d" "$FILE"; then
+  echo "$BLOCK" >> "$FILE"
+else
+  echo ".bashrc.d block already exists"
+fi