• 请不要在回答技术问题时复制粘贴 AI 生成的内容
andforce
V2EX  ›  程序员

赛博后悔药

  •  
  •   andforce · 18h 33m ago · 751 views
     unalias rm 2>/dev/null
     function rm {
       local args=()
       for arg in "$@"; do
         case "$arg" in
           -*) ;;  # 跳过所有 flag ,只保留文件路径
           *) args+=("$arg") ;;
         esac
       done
       if [[ ${#args[@]} -eq 0 ]]; then
         echo "rm: missing operand"
         return 1
       fi
       trash "${args[@]}"
     }
    

    放到 Mac 的 ~/.zshrc 中,这样所有删除都会进入回收站

    liuxue
        1
    liuxue  
       14h 44m ago
    如果 ai 不使用你的环境变量,不还是会出问题么
    ruanimal
        2
    ruanimal  
       1h 58m ago
    你没有用过 trash-cli 吗? 另外 ai 很喜欢用绝对路径,alias 其实作用也不大
    cheng6563
        3
    cheng6563  
       1h 16m ago
    windows ,让 AI 糊了个 sbox.md ,sbox codex 这样启动 codex ,就建一个 sandboxie 区,只给当前目录设置完全访问,其他目录全走 sandboxie
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3441 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 04:54 · PVG 12:54 · LAX 21:54 · JFK 00:54
    ♥ Do have faith in what you're doing.