#!/bin/bash
filename=~/.animals
echo -n "Enter an animal name: "
read name
is_in_file=`grep $name $filename`
if [ -n "$is_in_file" ]; then
echo $is_in_file | cut -d= -f2
else
echo -n "Give me description for $name: "
read description
echo " $name=$description" >> $filename
fi
is there a way i can make it work different?
i don't want my script to ask for the name. Name should be passed as the first command line argument to the script and description as the second argument
./zoo.sh animal Description
i am learning unix on my own and the book i am using does not make it clear.
any help will be appreciated.