Sample Header Ad - 728x90

How to make base64 print the encoded output after a newline without newline being encoded?

0 votes
1 answer
961 views
I like to encode with base64 from stdin by invoking the command pasting the input and pressing Ctrl + D twice in order to avoid a trailing newline if I don't want one to be part of the input. It avoids echo and leaves no data in the shell history. However, the output is written directly after the input and it's hard to retrieve the value:
$ base64
Input without trailing newlineSW5wdXQgd2l0aG91dCB0cmFpbGluZyBuZXdsaW5l
Is there any way I can look like
$ base64
Input without trailing newline
SW5wdXQgd2l0aG91dCB0cmFpbGluZyBuZXdsaW5l
without any newlines being included in the encoded output? I'm using Ubuntu 23.10.
Asked by Kalle Richter (2252 rep)
Nov 20, 2023, 11:24 AM
Last activity: Nov 20, 2023, 11:38 AM