bash - Directory of a file from path -


I have a string of file paths in my shell script.
The path of the directory I want to remove the file part

For example, if the path is: path = "/ var / www / index.html" me / var /

Post-text "itemprop =" text ">

Try:

  ~ $ Path = "/ var / www / index.html" ~ $ dir = $ {path% / *} ~ $ $ echo $ dir / var / www    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -