Description | Bash | PowerShell |
---|---|---|
Output “test” to a file | echo “test” > test.txt | “test” | Out-File test.txt |
Store the output of file test.txt in the variable “file” | file=$(cat test.txt) | $file=Get-Content test.txt |
Upper-case the contents of a variable | variable=$(echo $variable) | tr a-z A-Z | $variable=$variable.ToUpper() |
Store the contents of standard input into a variable | read -p ‘Input a value: ‘ variable | $variable=Read-Host “Input a value:” |