if I have a variable value "filetoprocess" equal to "/aaa/bbb/ccc"
How can I simply extract the file name of "ccc"
if I have a variable value "filetoprocess" equal to "/aaa/bbb/ccc"
How can I simply extract the file name of "ccc"
filename=${filetoprocess##*/}
Hi Franklin,
could you please explain the solution?
thanks in advance.
I can't explain it better then this:
Learning the Korn Shell, 2nd Edition: Chapter 4: Basic Shell Programming Pattern-Matching Operators
You could also use basename.
basename "/aaa/bbb/ccc"
or to put it in a variable
filename=`basename "/aaa/bbb/ccc"`