minor bug fix
[distro-setup] / conflink
index aecd0377119a99daf04b7d0e497e65c46f729de0..0ae24c332cce236812b3d2521bd332edd8f96934 100755 (executable)
--- a/conflink
+++ b/conflink
@@ -24,14 +24,27 @@ m() {
 s() { sudo "$@"; }
 
 lnf() { /a/exe/lnf "$@"; }
+now=$(date +%s)
+
+# error prone
+#f=~/.local/conflink
+# fast=false
+# if [[ -e $f ]] && (( $(stat -c %Y $f) > $now - 60*60*24 )); then
+#   fast=true
+# fi
 if [[ $1 == -f ]]; then # f for fast
-  lnf() { ln -sf "$@"; }
+  fast=true
+  shift
 elif
   [[ $1 ]]; then
   echo "error: unrecognized arguments" >&2
   exit 0
 fi
 
+if $fast; then
+  lnf() { ln -sf "$@"; }
+fi
+
 shopt -s nullglob
 shopt -s extglob
 shopt -s dotglob
@@ -164,4 +177,3 @@ case $user in
     echo "$0: error: unexpected user"; exit 1
     ;;
 esac
-