Still working on the dvd-slideshow thing I have found that it would b nice to globally control the generation of control files for it, and in that process I have found that it is an advantage to extract file names from full paths. This can be achieved with the following simple function:

function path2file {
echo $1 | egrep -o '/([[:alnum:] _-])*$' | sed 's/\///' ;
}

which takes a path as argument and gives back the file eg:

path2file ~/Documents/Programming/dvd-slideshow/dvd-burn
returns:
dvd-burn

This of course does not work for windows paths, but you can always exchange slash for backslash (only the escaped ones) to make it windows oriented :)

Edit: well of course there is already a tool for this in bash namely the history command with all its nice options. See for instance this tutorial.

Leave a Reply