#!/bin/bash

# Script 1

# lines starting with a # are comments and are ignored by the script processor

# clear the terminal window
clear

# demonstrate using system variables with echo output
echo "The system variable, \$USER, holds the current user name."
echo "So, \$USER=$USER"
echo 
echo "Hello, $USER"

echo "Your current directory is $PWD"
echo

echo "The files in $PWD, are:"
ls -l $PWD

# demonstrate reading in user input
echo
echo
echo -n "What text are you looking for? "
read srchtext
echo
echo "You are searching for \"$srchtext\"."
echo

# demonstrate using the inputted text in a command
echo "Conducting search in the current directory..."
echo
grep $srchtext $PWD/*.*
echo
echo Search complete.  There were `grep $srchtext $PWD/*.* | wc -l` occurrences found.

