How to split the file name from the path in BASH?
What's the easiest way to obtain the file name and the path in 2 independent strings in a command like:
rm /path/file so string1=/path string2=file How the bash commands do it? Thank you for your time |
dirname
|
OK, I guess it's simple done with dirname and basename :P
|
Or, if you have it stored in a variable such as ${a} (for lack of a better name), you can get the directory and the file using ...
Code:
dir=${a%/*} |
All times are GMT -5. The time now is 10:27 PM. |