To list available contexts: kubectl config get-contexts To show the current context: kubectl config current-context…
Tee-Object and Invoke-Expression in PowerShell
The PowerShell Tee-Object Cmdlet allows you to send command output to a file or a variable, and display it in the console at the same time. This is very useful for those instances where you need to parse the text output of a command. I had a hard time getting it to work with Invoke-Expression. After trying different things, I finally found the solution. To get Tee-Object to work with Invoke-Expression in PowerShell 1, include the Tee command in the Invoke-Expression command like this:
Invoke-Expression "mvn clean install | Tee –variable result”
The following, which I guess is what most people try first, doesn’t work (at least in PowerShell V1). I guess because you are storing the result of the “Invoke-Expression” command itself into the variable instead of “mvn clean install”.
Invoke-Expression "mvn clean install” | Tee -variable result
Wrapping Invoke-Expression in parenthesis (see below) works, but has a drawback: the output is not written to Standard Out until the whole command finishes.
(Invoke-Expression "mvn clean install”) | Tee -variable result
[…] Tee-Object and Invoke-Expression in PowerShell This entry was posted on Thursday, January 7th, 2010 at 10:10 pm and is filed under PowerShell, Programming. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. […]
. lostfilm
Tee-Object and Invoke-Expression in PowerShell – Chinh Do
Бэтмен комикстері
Tee-Object and Invoke-Expression in PowerShell – Chinh Do
shooting eye protection
Tee-Object and Invoke-Expression in PowerShell – Chinh Do
school ict suites
Tee-Object and Invoke-Expression in PowerShell – Chinh Do
software akuntansi
Tee-Object and Invoke-Expression in PowerShell – Chinh Do