#!/bin/sh directory=/ftp/pub/users/trevorb rel_dir=/users/trevorb server=sdf-eu.org port=70 # The internal field separator is set to be a newline IFS=' ' if [ -n "$1" -a "$1" = 'date' ] ; then ls_arg=t fi for i in $(ls -l${ls_arg} $directory) ; do content=$(echo "$i" | awk '{ print $9}') date=$(echo "$i" | awk '{ print $6,$7,$8}') if [ -z "$content" ] ; then continue fi if [ -d $directory/$i ] ; then itemtype=1 else itemtype=0 fi echo "$itemtype$content ($date) $rel_dir $server $port" done