Using an alias in find -exec

前端 未结 7 676
醉酒成梦
醉酒成梦 2021-01-07 19:11

I have a very long command in bash, which I do not want to type all the time, so I put an alias in my .profile

alias foo=\'...\'

Now I want

7条回答
  •  生来不讨喜
    2021-01-07 19:54

    find itself doesn't know anything about aliases, but your shell does. If you are using a recent enough version of bash (I think 4.0 added this feature), you can use find . -exec ${BASH_ALIASES[foo]} {} \; to insert the literal content of the alias at that point in the command line.

提交回复
热议问题