My scripts for startup, dmenu, and the command line
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

44 行
968 B

  1. #!/bin/sh
  2. #To add more caches, add a newline to this string and follow the existing name:path format
  3. cache_info="home:$HOME"
  4. init() {
  5. mkdir -p $XDG_CACHE_HOME/mru
  6. }
  7. get_cache_path() {
  8. if [ -z "$1" ]; then printf "invalid arg to cache_path\n"; exit; fi
  9. }
  10. update() {
  11. file=$XDG_CACHE_HOME/mru/"$1"
  12. if [ -z "$1" ]; then file="$file""home"; fi
  13. path=$(printf $cache_info | grep "^$1" - | cut -d: -f2)
  14. if [ -z "$path" -o ! -e "$path" ]; then
  15. printf "path:$path from cache:$file does not exist\n"; exit;
  16. fi
  17. find $path -type f -not \( -path '*/.*/*' -o -path '*node_modules/*' -o \
  18. -path '*Backups/my-plugins*' -o -path '*.sw[po]' \) -printf \
  19. '%TY-%Tm-%Td\t%TT\t%p\n' | sort -r > $file
  20. }
  21. output() {
  22. if [ -z "$2" ]; then
  23. cat $XDG_CACHE_HOME/mru/home; else cat "$XDG_CACHE_HOME/mru/$2";
  24. fi
  25. }
  26. list() {
  27. output "$1" | cut -f3
  28. }
  29. case "$1" in
  30. init) init "$2";;
  31. update) update $2;;
  32. output) output "$2";;
  33. list) list "$2";;
  34. insert) insert "$2";;
  35. esac