Re: sha256sum --text generating blank spaces and hyphens?
Hello,
On Wed, Apr 26, 2023 at 07:41:56AM +0000, Albretch Mueller wrote:
> _SHA256=$(printf '%s' "${_TXT}" | sha256sum --text )
> echo "// __ \$_SHA256: |${_SHA256}|"
[…]
> // __ $_SHA256:
> |7d5895cb24ab49692a8ad495e036074fec8e61b22040544f02a9b69c926dbdeb -|
>
> I am trying to avoid funky characters and sha256sum --text still
> generates them!?!
If you're referring to the space and then the file name ("-" in case
of stdin) on the end, you can just select only the first output up
to whitespace with e.g. awk:
_SHA256=$(printf '%s' "${_TXT}" | sha256sum | awk '{print $1}')
Your use of "--text" does nothing by the way.
> I work like this because I need replicate the original URL as a local
> path in a way that would be compatible any file system.
These web sites can change their URLs at any time you know, so it
may not be worth trying to replicate their structure locally.
Also maybe you want some sort of web site mirroring solution.
Cheers,
Andy
--
https://bitfolk.com/ -- No-nonsense VPS hosting
Reply to: