Bash: using commands as parameters (specificly cd, dirname and find)
Posted
by sixtyfootersdude
on Stack Overflow
See other posts from Stack Overflow
or by sixtyfootersdude
Published on 2010-03-15T18:44:33Z
Indexed on
2010/03/15
18:49 UTC
Read the original article
Hit count: 329
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...
© Stack Overflow or respective owner