Reputation: 466
The problem is:
After user enter a linux command.
How can I get the output of the first command using another command?
Note: we cannot redirect output of first command to somewhere.
Upvotes: 1
Views: 3437
Reputation: 246807
Using history expansion
$ date -d "12:00"
Thu Sep 19 12:00:00 EDT 2013
$ d=$(!!)
$ echo $d
Thu Sep 19 12:00:00 EDT 2013
Upvotes: 3