]> git.armaanb.net Git - charsel.git/blobdiff - charsel
changed from .cache directory to /tmp
[charsel.git] / charsel
diff --git a/charsel b/charsel
index 3961cf2f38bd47bd8b9aa3e0f2938fa8591ea270..dc2564f54921231b4803486ff72d168389fc5650 100755 (executable)
--- a/charsel
+++ b/charsel
@@ -1,12 +1,14 @@
 #!/usr/bin/env sh
 
 # Merge both global and local charfiles
-mkdir ~/.cache/charsel/ &
-cp /usr/share/charsel/* ~/.cache/charsel/
-cp ~/.local/share/charsel/* ~/.cache/charsel/
-CHARDIR=~/.cache/charsel
+CHARDIR=/tmp/charsel
+cp /usr/share/charsel/* $CHARDIR
+cp ~/.local/share/charsel/* $CHARDIR
 
-# clear screen
+# Check if user provided a charfile
+[ -z "$1" ] && echo "No argument supplied"  && exit 1
+
+# Clear screen
 clear
 
 while :
@@ -14,7 +16,7 @@ do
   
   # Put charfile into table
   column -t $CHARDIR/$1 -N SHORT,CHAR -R SHORT,CHAR --output-separator ' | '
-  read INPUT
+  read -n 1 INPUT
   
   # Navigate to the right characther
   OUTPUT=$(grep $INPUT $CHARDIR/$1 | cut -c 3)
@@ -22,7 +24,6 @@ do
   # Clear screen
   clear
 
-  # Print output, and copy to clipboard
-  echo $OUTPUT
+  # Copy output to clipboard
   echo $OUTPUT | xclip -selection clipboard
 done