Hi guys, last cry for help for today. I appreciate the help so far.
ok so I have a program that dumps a path into my script as a variable ($1)
This path is an example
/home/xbmc/sab_downloads/video/tv/grey's anatomy/season 3
So in order to search thetvdb.com for a show, I need to extract the show name to pass to the other portions you guys have been helping me with so far today. The show name in the path will always be correct and there may often be spaces. I know I can truncate the last dir from the path using dirname but in this case I need to keep the show name.
the beginning of the path:
/home/xbmc/sab_downloads/video/tv
will always be the same with no exceptions however there may not always be anything trailing the name of the show, for example:
/home/xbmc/sab_downloads/video/tv/example
How can I truncate the name of the show in this environment and save it to a variable?
Read the "Parameter Expansion" section of your shell's man page (or the POSIX Parameter Expansion page, or chapter 1 of my book, Shell Scripting Recipes, or any of the many tutorials on the web).