fixed excess copying
authorArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Thu, 15 Oct 2020 18:08:44 +0000 (14:08 -0400)
committerArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Thu, 15 Oct 2020 18:08:44 +0000 (14:08 -0400)
src/charsel

index f435fde43882656299509420f85f32cf44f3b298..84c0affc7a0a26d9ff8fb028377a1d871ee3b5aa 100755 (executable)
@@ -1,9 +1,12 @@
 #!/usr/bin/env bash
 # Merge both global and local charfiles
 CHARDIR=~/.cache/charsel
-mkdir $CHARDIR/
-cp -R /usr/share/charsel/* $CHARDIR/
-cp -R ~/.local/share/charsel/* $CHARDIR/
+
+if [[ ! "$(ls -A $CHARDIR)" || ! -d $CHARDIR ]]; then
+  mkdir $CHARDIR/
+  cp -R /usr/share/charsel/* $CHARDIR/
+  cp -R ~/.local/share/charsel/* $CHARDIR/
+fi
 
 # Check if user provided an input
 if [ $1 = "list" ]; then