Change: xecho: execute permission denied error

Hello,

I am have an issues with one of my scripts. I get the following error when I get to the point in the script where I am making the change. The change does take however. the error is "change: xecho: execute permission denied"

Everything was working properly until I start cleaning up the code. (indent) :frowning:

ans=y
while [ "$ans" = "y" ]
do

	cat<<here0

${bold}Please enter the name of the user you want to change:${off}

here0

	read name

	clear

	grep -in "$name" phonebook | sed -n -e 's/^/\
				/' -e 's/:/\
				/gp'

	cat<<here1
	
${blink}${bold}Please enter the record that you want to change:${off}    

here1

	read number

record=`sed -n ${number}p phonebook`

name=`echo "$record"| cut -d: -f1`
address=`echo "$record"|cut -d: -f2`
city=`echo "$record"|cut -d: -f3`
state=`echo "$record"|cut -d: -f4`
zip=`echo "$record"|cut -d: -f5`
phone=`echo "$record"|cut -d: -f6`

	echo "Do you want to change $name's name? (y/n) \c"
	read ans
	if [ "$ans" = "y" ]
		then 
     			echo "Please enter new name"
     			read newname
     			name=$newname

	fi

	xecho "Do you want to change $address?  (y/n) \c"
	read ans
	if [ "$ans" = "y" ]
		then 
     			echo "Please enter new address"
     			read newaddress
     			address=$newaddress

	fi

	echo "Do you want to change $city?  (y/n) \c"
	read ans
	if [ "$ans" = "y" ]
		then 
     			echo "Please enter new city"
     			read newcity
     			city=$newcity

	fi

	echo "Do you want to change $state?  (y/n) \c"
	read ans
	if [ "$ans" = "y" ]
		then 
     			echo "Please enter new state"
     			read newstate
     			state=$newstate

	fi

	echo "Do you want to change $zip?  (y/n) \c"
	read ans
	if [ "$ans" = "y" ]
		then 
     			echo "Please enter new zip"
     			read newzip
     			zip=$newzip

	fi

	echo "Do you want to change $phone?  (y/n) \c"
	read ans
	if [ "$ans" = "y" ]
		then 
     		echo "Please enter new phone number"
     		read newphone
     		phone=$newphone
	

	fi

	sed "$number"d phonebook > phonebook.tmp
	mv phonebook.tmp phonebook
	echo "$name:$state:$city:$state:$zip:$phone" >> phonebook
	echo "Would you like to change another record? /c"
	read ans

done

---------- Post updated at 04:04 PM ---------- Previous update was at 03:14 PM ----------

Never mind I found the issue. It was a typo.

One other issue that I am having is when a user is not found in the file it hangs until the user presses return. How can I do some type of validation?

Thanks

Hi.

Welcome to the forums.

Meta-answers:

Psychology 101: Post the shortest possible example of the problem. You posted 100+ lines. I would not slog through that to find an error. You didn't seem to put in much time to seek the answer with experimentation, so why should I spend my time? There are situations when you may need to post an entire script, but I have found that to be a rare occasion.

Psychology 102: Ask one question per thread. You added that you solved the problem, then more than 100 lines down, you bury your second question. Most people will have quit reading before or by that point.

Think how you would like questions asked of you, probably: short, and one main question per thread.

Best wishes ... cheers, drl

Thanks for the advise. After I spotted the typo I wanted to remove the post. Is that possible? Thanks

Hi.

I don't recall for sure. On some forums when you edit a post, you are given the option to delete. However, if there has been a reply, then probably not because that would destroy the continuity and context.

I would not worry about this one in any case, just post your new question in a new thread. You can certainly refer to this thread from your new thread by copying this URL if necessary.

Good luck ... cheers, drl