#!/bin/sh

#
# Application selector v1.0
#
#
# This makes all files at /home/ftp executable.
# If there exists a file (program) named "menu" it will be executed.
# If not the first program found will be executed.
# If there are no programs found a message will be printed.
#

chmod 777 /home/ftp/* 2> /dev/null
if [ -e "/home/ftp/menu" ]; then
  /home/ftp/menu
  exit 0
else
  APP=""
  for en in `ls /home/ftp/* 2> /dev/null`; do
    APP=$en
    ./$en
    exit 0
  done
fi

echo "Nothing to start. Please transfer a program via ftp first."
