how to write shell prog

how to write shell program. EX : to check whether a string is a palindrome or not.

You may try it on C program. Here is a code that checks whther the string is palindrome or not in C.

main(c,v)
char**v;
{
	char*p;
	for(c>1?p=strchr(*++v,0):exit(1);*(*v)++==*--p&&*v<p||exit(puts(*v<p?"n":"y")-2) ; ) ;
}

Dear Killer,

You fell for it, head over heels.

Another homework question!!! ie. 1st post, general question content. Someone the other day was looking for a script for this same purpose. Here is that one...

I know we are eager to help everyone on this site with their problems and questions, but please discourage them Killerserv... Or at least make them work for the answer... :wink:

"Laxity breeds contempt... Perseverance breeds awareness..."

I wish I could close this post, but I will have to leave that to a moderator. Could someone help me out with this request?

This is not a demand, but a humble request. I would like to become a moderator. I think that I have what it takes... Can someone put in a good word for me with Neo???:slight_smile:

Thanks.

Acknowledged Kelam. Never knew it would content a Homework quesition.

Actually, I thought you replied to a homework question with an answer that no first year CS student would be able to explain to an instructor. I thought it was quite a subtle response...

after this thread i have a question, why would you discourage someone? or close this post? is there some sort of occult knowledge that only few are privy to ? why would you not help someone seeking an answer?

vyrus

It is not this forum's intention to discourage anyone from seeking help. However, if you go through this thread, you probably will see how most non school/college guys feel about homework postings.

To sum it up, you are not going to learn anything by getting someone else to do your homework for you. However, if you have put together a solution yourself that just falls short of the requirement, you will find that quite a few guys are willing to help you with that.

what is a homework assignment? is this a school based forum? i pulled this site up looking for information on how to start learning unix.

You can find homework assignments quite easily. Shell programs that *have* to be written using only sed, and not awk or perl, programs that are supposed to touch 10 files named 1 to 10 and then carry out operations on those files are some examples.

If you want to learn about unix, this is a good place to start. Go through the tutorials from the FAQs, install Linux/BSD/Solaris at home and start scripting, then you could move on to C (though I learned it the other way round).

thank you.