|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Can I tee into a variable rather than file?
Is there a way i can tee into a variable rather than a file?
I want stdout and stderr to go to the screen as it is happening and capture a copy of it in a variable. I can capture them w/ std_out_and_err=$($the_command 2>&1) and then print $std_out_and_err. But the command may be putting out output for a minute or more and I really want it visible as it is happening. I was hoping the tee command would do the trick but I couldn't figure it out. Thanks. |
|
#2
|
|||
|
|||
|
Code:
$the_command 2>&1 > somefile; myvariable=`cat somefile` |
|
#3
|
|||
|
|||
|
thanks. Creating a file's better than nothing, but does anyone know of a way to not have to create a file?
|
|
#4
|
|||
|
|||
|
x=$(some_command 2>&1 | tee /dev/tty)
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Can I tee into a variable rather than file? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|