0

In ~/.tcshrc, I have the following aliases:

alias   trash   'echo  ./*{~,.bak,.save} ./.*{~,.bak,.save} ./#*#'
alias   trashit 'rm -f ./*{~,.bak,.save} ./.*{~,.bak,.save} ./#*#'

How can I implement the same in zsh? The curly brace expansion seems to fail unless all criteria are met.

h q
  • 1,168
  • 2
  • 10
  • 23
  • zsh fails the command if any glob fails for safety reasons. Try `|` pattern and local nullglob `(N)` like this: `echo ./*(~|.bak|.save)(N) ./.*(~|.bak|.save)(N) ./\#*\#(N)`. Read more: https://unix.stackexchange.com/a/204944/252440, https://unix.stackexchange.com/a/298625 – Phu Ngo Apr 01 '21 at 08:32
  • Shorter one with `dotglob`: `echo ./*(~|.bak|.save)(DN) ./\#*\#(N)` – Phu Ngo Apr 01 '21 at 08:34
  • Thank you @PhuNgo. This is an acceptable answer for me. – h q Apr 01 '21 at 09:07
  • @PhuNgo So, why not put this into an answer, instead of a comment? – Marlon Richert Apr 01 '21 at 09:44

0 Answers0