#!/bin/bash function -noedit () { read -p "What file would you like to look at ? " filename cat $filename | more exit } function script () { clear echo "Run $0 -noedit to just look at a file" echo "run $0 -overwrite to overwrite a file" echo "Run $0 -edit to edit a existing file " echo " Commands: Press enter to save file ;when done press ctrl + c to exit ." read -p " Press enter to start typing " enter clear newline clear exit } function newline () { read -p " " text echo $text >> $filename clear cat $filename newline } function -overwrite () { read -p "What file would you like to overwrite ? " filename rm -f $filename touch $filename script } 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 " ; echo "this file, run $0 -edit . To overwrite this file and create a new " read -p "one run $0 -overwrite . Please enter new filename : " filename ; filexist ; fi } $1 read -p "What would you like to call the file ? " filename filexist touch $filename clear echo "Run $0 -noedit to just look at a file" echo "run $0 -overwrite to overwrite a file" echo "Run $0 -edit to edit a existing file " read -p " Commands: Press enter to save file ;when done press ctrl + c to exit ." enter clear newline clear exit