#!/bin/tcsh printf "Please Enter the File's Directory name or Q to Exit program>" set directory = $< #while ($directory != "" && !(-e $directory)) #Keep prompting until the user types a correct folder while (1) #Continue looping until the user decides to type something intelligent if ($directory != "") then #Make sure no null input is given causing -e to crash if (-e $directory) then break; #Continue asking for filename if directory exists else if ($directory == 'Q' || $directory == 'q') then #Or give up if they cannot remember and exit echo "Exiting Program...We will miss you! :(..." exit(0) endif endif echo "Directory $directory Does not Exist!" printf "Please Enter the File's Directory name or Q to Exit program>" set directory = $< end return $directory