#!/bin/bash function -edit () { clear ; read -p "What is the name of the file you would like to edit : " filename clear read -p " Commands: Press enter to save file when done. Press enter now to start typing." enter ; clear ; cat $filename read -p " " text ; echo $text >> $filename ; clear ; echo "the file now looks like this :" cat $filename sleep 3 clear exit } function filexist () { if [[ -e $filename ]] then echo "file already exists, please choose another name. If you would like to edit " ; read -p "this file, run $0 -edit . Please enter new filename : " filename ; filexist ; fi } $1 read -p "What would you like to call the file ? " filename filexist touch $filename clear read -p " Commands: Press enter to save file when done. Press enter now to start typing." enter clear read -p " " text echo $text >> $filename clear exit