New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NewLine is added to output when told to explicitly drop NewLine #15222
Comments
Pretty sure this is a bit of a wider issue, given that simply |
Yes, unfortunately the trailing newline can currently not be prevented - please see #5974 |
As a workaround you can use the .NET method instead of relying on platform specific binaries being place. [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('hello')) It's more verbose but the benefit is that it it's portable, unlike calling But if |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@jborean93: so, I'm the only one on the team using |
@johnjelinek, calling the platform-native shell is always an option: PS> sh -c "printf %s 'hello' | base64"
aGVsbG8K= |
To generalize the approach (see caveat below): PS> sh -c 'printf %s "$1" | base64' - 'hello'
aGVsbG8K= |
P.S., @johnjelinek: passing a string such as |
Ok, thanks for the help! Do we want to leave this open or close the issue? |
|
PowerShell Core 7.2.0-preview.5 has just been released, which includes the Thus, in PowerShell Core 7.2.0-preview.5 the following now works correctly on Unix-like platforms (assuming the experimental feature is on and the # Malfunctions in PowerShell Core 7.2.0-preview.4 and below, because `"$1"` turns into `$1`, which
# makes `sh` perform word-splitting, resulting in *two* arguments.
PS> sh -c 'printf %s "$1" | base64' - 'hello more'
aGVsbG8gbW9yZQ== |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
2 similar comments
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
A newline is getting added to the output when running
echo
even if I tell it not to (with-n
flag). It also looks likeWrite-Out
doesn't support-NoNewLine
.Steps to reproduce
Expected behavior
Actual behavior
Environment data
The text was updated successfully, but these errors were encountered: