Trevor SullivanT
Windmill3y ago
1 reply
Trevor Sullivan

Native script editor for PowerShell

Would it be possible to directly edit PowerShell scripts, instead of embedding them in Bash here-strings?

PowerShell supports special syntax, such as multi-line commands, using the backtick as the "line continuation" character. Using this syntax, and perhaps others, breaks the Bash parser.

All you'd have to do is write the text from the editor to a file, and then execute the pwsh -File command instead of executing Bash.

cat > script.ps1 << EOF
Write-Host -Object 'Multi' `
  'Line' `
  'Command'
EOF

pwsh -File script.ps1
image.png
Was this page helpful?