0
I have searched one file "portmap" inside root directory as follows:
find -name "portmap"
It gives location of file
.init/...somepath./portmap
Now I want to change my current directory to the location of portmap file and print the present working directory.
So I am thinking of pipeline the above location to cd. But how can I do it with one command?
Please help
Hello, Thanks for the reply. But it gives me error basedir command not found. I just copy pasted above line. Does this work in mint command prompt? Thanks – techfun – 2014-01-23T19:42:15.537
1@techfun I think DopeGhoti meant
dirname
. Also, you should double-quote the substitutions to prevent paths with spaces from breaking the command. – slhck – 2014-01-23T20:56:23.403Yes, I did, thanks @slhck. For some reason, I get the
basename
anddirname
wires crossed in my head every time. – DopeGhoti – 2014-01-23T21:43:15.257Happy to have helped. – DopeGhoti – 2014-01-23T22:09:35.517