Bash: using commands as parameters (specifically cd, dirname and find)
- by sixtyfootersdude
This command and output:
% find . -name file.xml 2> /dev/null
./a/d/file.xml
%
So this command and output:
% dirname `find . -name file.xml 2> /dev/null`
./a/d
%
So you would expect that this command:
% cd `dirname `find . -name file.xml 2> /dev/null``
Would change the current directory to ./a/d. Strangely this does not work. …