Index: trunk/src/lib/shell/shell_command.cc
===================================================================
--- trunk/src/lib/shell/shell_command.cc	(revision 5195)
+++ trunk/src/lib/shell/shell_command.cc	(revision 5196)
@@ -41,5 +41,4 @@
   this->classID = CL_NULL;
   this->commandList = new tList<ShellCommandBase>;
-  this->aliasList = new tList<ShellCommandAlias>;
 
   ShellCommandClass::commandClassList->add(this);
@@ -91,16 +90,16 @@
 bool ShellCommandClass::getCommandListOfAlias(tList<const char>* stringList)
 {
-  if (stringList == NULL)
+  if (stringList == NULL || ShellCommandClass::aliasList == NULL)
     return false;
 
   tIterator<ShellCommandAlias>* iterator = ShellCommandClass::aliasList->getIterator();
-  ShellCommandAlias* elem = iterator->firstElement();
-  while(elem != NULL)
-  {
-    stringList->add(elem->getName());
-    elem = iterator->nextElement();
-  }
-  delete iterator;
-  return true;
+   ShellCommandAlias* elem = iterator->firstElement();
+   while(elem != NULL)
+   {
+     stringList->add(elem->getName());
+     elem = iterator->nextElement();
+   }
+   delete iterator;
+   return true;
 }
 
@@ -126,14 +125,17 @@
 
   // unregister all aliases (there should be nothing to do here :))
-  tIterator<ShellCommandAlias>* itAL = ShellCommandClass::aliasList->getIterator();
-  ShellCommandAlias* elemAL = itAL->firstElement();
-  while(elemAL != NULL)
-  {
-    delete elemAL;
-    elemAL = itAL->nextElement();
-  }
-  delete itAL;
-  delete ShellCommandClass::aliasList;
-  ShellCommandClass::aliasList = NULL;
+  if (ShellCommandClass::aliasList != NULL)
+  {
+   tIterator<ShellCommandAlias>* itAL = ShellCommandClass::aliasList->getIterator();
+   ShellCommandAlias* elemAL = itAL->firstElement();
+   while(elemAL != NULL)
+   {
+     delete elemAL;
+     elemAL = itAL->nextElement();
+   }
+   delete itAL;
+   delete ShellCommandClass::aliasList;
+   ShellCommandClass::aliasList = NULL;
+  }
 }
 
@@ -213,4 +215,5 @@
   this->setName(commandName);
   this->description = NULL;
+  this->alias = NULL;
 
 //  this->classID = classID;
@@ -267,4 +270,9 @@
 {
   delete[] this->parameters;
+  if (this->alias != NULL && ShellCommandClass::aliasList != NULL)
+  {
+    ShellCommandClass::aliasList->remove(this->alias);
+    delete this->alias;
+  }
 }
 
@@ -462,6 +470,21 @@
 ShellCommandBase* ShellCommandBase::setAlias(const char* alias)
 {
-  ShellCommandAlias* aliasCMD = new ShellCommandAlias(alias, this);
-  ShellCommandClass::aliasList->add(aliasCMD);
+  if (this == NULL)
+    return NULL;
+
+  if (this->alias != NULL)
+  {
+    PRINTF(2)("not more than one Alias allowed for functions (%s::%s)\n", this->getName(), this->shellClass->getName());
+  }
+  else
+  {
+    if (ShellCommandClass::aliasList == NULL)
+      ShellCommandClass::aliasList = new tList<ShellCommandAlias>;
+
+    ShellCommandAlias* aliasCMD = new ShellCommandAlias(alias, this);
+    ShellCommandClass::aliasList->add(aliasCMD);
+    this->alias = aliasCMD;
+  }
+  return this;
 }
 
Index: trunk/src/lib/shell/shell_command.h
===================================================================
--- trunk/src/lib/shell/shell_command.h	(revision 5195)
+++ trunk/src/lib/shell/shell_command.h	(revision 5196)
@@ -85,5 +85,4 @@
 
     /** @returns the CommandList of the Shell */
-
     static void unregisterCommand(const char* commandName, const char* className);
 
@@ -114,4 +113,5 @@
   private:
     ShellCommandClass*               shellClass;                           //!< A Pointer to the Shell-Class this Command belongs to.
+    ShellCommandAlias*               alias;                                //!< An Alias for the Class.
 
     const char*                      description;                          //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");
@@ -319,9 +319,12 @@
 class ShellCommandAlias
 {
+  friend class ShellCommandBase;
   public:
-    ShellCommandAlias(const char* aliasName, ShellCommandBase* command) { this->aliasName = aliasName; this->command = command; };
-
     const char* getName() const { return this->aliasName; };
     ShellCommandBase* getCommand() const { return this->command; };
+
+  private:
+    ShellCommandAlias(const char* aliasName, ShellCommandBase* command) { this->aliasName = aliasName; this->command = command; };
+
   private:
     const char*         aliasName;
