Possible Duplicate:
bash - automatically capture output of last executed command into a variable
For example
In Bash shell
user:/ & echo "Hello"
Hello
user:/ & date
Sat Mar 17 01:48:45 ICT 2012
How to get the "Hello
" or "Sat Mar 17 01:48:45 ICT 2012
" variables
I mean every output from command bash shell
The purpose of this point, I want to get those variables and do something with its.
Like, when echo Hello I want to reverse string to olleH and then print it out.
Something like this
echo "Hello"
olleH
More Information
In Command Line Interface ***Not in Shell Script
When I type a command echo,date (or whatever command) in the Command Line Interface, The output will show in the next line.
user:/ & echo "Hello" <br>
Hello
The "Hello" variable is the output of bash shell. So, I want to store output Hello into variable and pass into "Dictionary Script"
The Hello will matched and translated depend on Dictionary Script
Hello = Hi (Just example)
Now Hello translated into Hi, send back to shell and print out
Result
user:/ & echo "Hello" <br>
Hi
How can I grab the output?
Could I expose the Bash Shell source, edit and re-compile?
Could I grab from the /proc/
BASHPID?