vendredi 6 mars 2015

Cut a string up to a certain character


I've searched the site and I've seen similar questions but I couldn't get them to work. I tried to follow: Splitting a string up to a specific location but it didn't work. I working with Korn.


I mainly want the directory of a file passed in. So the file would be:



/home/me/working/from/here/howareyou.txt


So I want to up get:



/home/me/working/from/here/


I've tried this but it didn't work:



THEDIR="${1%//*}"


But it just spit out the whole parameter. Any help would be appreciated. Thanks.



Aucun commentaire:

Enregistrer un commentaire