[Gllug] Silly bash question: changing directory
Joel Bernstein
joel at fysh.org
Thu Aug 11 15:36:23 UTC 2005
On Thu, Aug 11, 2005 at 04:33:34PM +0100, James Goldwater wrote:
> I'm betting myself this is trivial, but I can't figure out a
> non-agonizing way of doing this involving 'cut -f -1' or something like
> thats bound to break on weird filenames.
>
> Given a file (say a/b/c/myfile.txt) I need to change directory to a/b/c.
> Is there a simple way of doing this in bash?
I'm sure you /could/ do it in the shell but it's much easier to just
hand it off to dirname(1).
/joel
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list