reading and reversing a string

Hi Everyone....I am new to Unix and BASH programming...I just want to read a string and reverse it and display.....can anyone help me out????

here's a good place to start.

Sorry to say.....But i did not understand anything from that.can u provide me anyother matter????

Here's the needed extract from the same 'matter':

# reverse each character on the line (emulates "rev")
sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'

Applying the 'matter' to sample "string":

$ echo 'abcd' | sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'
dcba

what does sed do????

This smells like a homework problem, can you explain what you're trying to achieve? What is the real world problem you're trying to solve?

Regards

'man sed' yields the following:

NAME
     sed - stream editor

SYNOPSIS
     /usr/bin/sed [-n] script [file...]

     /usr/bin/sed   [-n]    [-e script]...    [-f script_file]...
     [file...]

     /usr/xpg4/bin/sed [-n] script [file...]

     /usr/xpg4/bin/sed [-n]  [-e script]...   [-f script_file]...
     [file...]

DESCRIPTION
     The sed utility is a stream editor that reads  one  or  more
     text  files,  makes editing changes according to a script of
     editing commands, and writes the results to standard output.
     The  script  is  obtained  from  either  the  script operand
     string, or a combination of the option-arguments from the -e
     script and -f script_file options.

     The sed utility is a text  editor.  It  cannot  edit  binary
     files  or files containing ASCII NUL (\0) characters or very
     long lines.

ofcourse thats a homework problem dude......i am new to unix so i have asked,is that a crime or anything against forum rules...?

please RE-read the forum rules.