ahk

ahk

USEFUL CONSTRUCTS IN KSH

###
### turn $path into just the NAME of the file
###
${path##*/}

###
### turn $file into just the DIRECTORY of the file
###
${path%${path##*/}}

###
###  turn $path into a FULL PATH
###
if [[ x${path#/} = x$path ]] ; then path=$PWD/$path ; fi

###
###  /$file  or nothing if $file is undefined
###   $file/ or nothing if $file is undefined
###  /$file/ or nothing if $file is undefined
###
${file:+/}${file}
          ${file}${file:+/}
${file:+/}${file}${file:+/}

##############################