#!/bin/sh echo echo "Testing user $USER to directory $1" echo echo "Try list directory" if ls "$1" then echo "$USER allowed to list files in $1" else echo "$USER prevented from listing files in $1" fi echo echo "Try change to directory" if cd $1 then echo "$USER can change directory to $1" cd .. else echo "$USER prevented from chainging directory to $1" fi echo echo "Try read a file in directory" if cat $1/FileB.txt then echo "$USER allowed to read file $1/FileB.txt" else echo "$USER prevented from reading file $1/FileB.txt" fi echo echo "Try create file" if echo "Created by $USER on `date +"%Y-%m-%d %T"`" > "$1/$USER.txt" then echo "$USER allowed to create file $1/$USER.txt" else echo "$USER prevented from creating file $1/$USER.txt" fi echo echo "Try append to file" if echo "Added by $USER on `date +"%Y-%m-%d %T"`" >> $1/FileA.txt then echo "$USER allowed to append to file $1/FileA.txt" else echo "$USER prevented from appending $1/FileA.txt" fi echo #echo "Try delete a file" #if yes | rm $1/FileB.txt #then # echo "$USER allowed to delete $1/FileB.txt" ## Recreate file for future testing # echo "More content `date +"%Y-%m-%d %T"`" >> $1/FileB.txt #else # echo "$USER prevented from deleting $1/FileB.txt" #fi #echo