Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: basename/dirname

Create two functions basename() and dirname() Given a path such as /home/foo/.mozilla/cache/data.txt the basename() function should return the filename ( data.txt in the example). The dirname() function should return the full-path directory name ( /home/foo/.mozilla/cache in the example.)