find wont use .bashrc alias
Bug #366665 reported by
Fernando Miguel
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
findutils |
New
|
Undecided
|
Unassigned | ||
findutils (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: findutils
i created this alias:
alias mp3gainB='mp3gain -r -k -t -p -s r'
then tried to run
$ find -type f -name "*.mp3" -exec mp3gainB {} \;
but it failed
running
$ find -type f -name "*.mp3" -exec mp3gain -r -k -t -p -s r {} \;
works as expected
ProblemType: Bug
Architecture: amd64
Dependencies:
libgcc1 1:4.3.3-5ubuntu4
gcc-4.3-base 4.3.3-5ubuntu4
findutils 4.4.0-2ubuntu4
libc6 2.9-4ubuntu6
DistroRelease: Ubuntu 9.04
NonfreeKernelMo
Package: findutils 4.4.0-2ubuntu4
ProcEnviron:
PATH=(custom, user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: findutils
Uname: Linux 2.6.28-12-generic x86_64
To post a comment you must log in.
The -exec param of find is executed by find, not by the bash, and find doesn't look into your aliases. This is expected behaviour. Find won't neither execute bash functions. And it does not allow redirection like such:
<code>
$ find -exec ls {} > /dev/null \;
<code>
You have to invoke bash as a login shell (-l) and set the shell option "expand aliases". Read "man bash", especially section ALIASES, for further insights.
<code>
$ find -type f -name "*.mp3" -exec bash -l -O expand_aliases -c "mp3gainB {}" ";"
</code>