문제

I'm not sure if it is possible but what I want to do is to run a bash command and storing the output in a variable AND display it as if I launched the command normally. Here is my code:

VAR=`svn checkout $URL`

So I want to store the output in VAR and still see the result (and because svn checkout takes a long time, I can't do echo $VAR just after..)

Thanks

도움이 되었습니까?

해결책

If the command is run from a terminal, you can do:

VAR=$(svn checkout $URL | tee /dev/tty)

다른 팁

You don't have to call the external tee:

VAR=$(svn checkout $URL) && echo $VAR

or even:

VAR=$(svn checkout $URL); echo $VAR
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top