Friday, January 19, 2018

Unix script to extract File Name and Base Path from File Path

$ VAR=/home/me/mydir/file.c
$ DIR=$(dirname "${VAR}")
$ echo "${DIR}"
/home/me/mydir
$ basename "${VAR}"
file.c

No comments: