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

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -