#!/bin/bash
# Rename a Konsole session (tab) to match the (possibly new) path.
kcd ()
{ local Path SessionName ThisTerm Owner OwnerDCOP Instances Konsole Mainwindows Mainwindow

# Get the new path.
  if [ $# = 1 ]; then     # No path was provided
    Path="$PWD"           # Just change the session's name
  fi

  if [ "$1" = '.' ]; then # It's the same as the current path
    Path="$PWD"           # Just change the session's name

  else
    Path="$1"             # Use the supplied path
  fi

# Change to the supplied path.
  cd $Path

# Change the Konsole session name to match the last node of the path.
  rexx /usr/local/bin/changeKonsoleSessionName $PWD
}

  export -f kcd
