--- layout: page category: File System tags: absolute relative path author: Marwan Announ title: fs ---
Now, you can ask, why I have to use one or another?
What is the difference? and questions like this.
Don't worry, the answer it's easy.., we can use an absolute path from any location
whereas you want to use relative path we should be present that you have to be in the working directory.
1)Absolute paths are clearer: who will have to maintain/modify your script (you or others) will be able to know
every time what directories are involved;
2)With absolute paths you are sure the involved directories are the one with the exact path you are writing
in the script;
3)Relative paths are shorter, but you need to be sure of the subtree you're working into;
4)You can achieve shortness replacing recurring paths with a variable at the beginning of the script
(e.g. /var/log/app/component/module/logfile.log -> $module_log_dir/logfile.log)