[Gllug] Silly bash question: changing directory

Russell Howe rhowe at siksai.co.uk
Thu Aug 11 17:06:17 UTC 2005


On Thu, Aug 11, 2005 at 04:33:34PM +0100, James Goldwater wrote:

> 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?

FOO="a/b/b/myfile.txt" echo "${FOO%\/*}"

-- 
Russell Howe       | Why be just another cog in the machine,
rhowe at siksai.co.uk | when you can be the spanner in the works?
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list