Bash: using commands as parameters (specificly 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. When I type cd ./a/d. The directory change works. However I cannot find out why the above does not work...