Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

tr: Illegal byte sequence #196

Closed
riywo opened this issue Nov 3, 2017 · 5 comments
Closed

tr: Illegal byte sequence #196

riywo opened this issue Nov 3, 2017 · 5 comments

Comments

@riywo
Copy link
Contributor

riywo commented Nov 3, 2017

https://github.com/arun-gupta/kubernetes-aws-workshop/tree/master/cluster-install

In my macOS Sierra bash terminal, the command below doesn't work:

$ export S3_BUCKET=example-state-store-$(cat /dev/random | LC_CTYPE=C tr -dc "[:alpha:]" | tr '[:upper:]' '[:lower:]' | head -c 32)
tr: Illegal byte sequence

Because of that, my $S3_BUCKET is not good.

$ echo $S3_BUCKET
example-state-store-
@arun-gupta
Copy link
Contributor

@wombat can you take a look at this? can you talk to @riywo to clarify this?

The command works on my machine.

@riywo
Copy link
Contributor Author

riywo commented Nov 3, 2017

Worked with LC_ALL=C instead of LC_CTYPE=C. cf. comment section of https://coderwall.com/p/4zux3a/random-string-generator-bash

$ cat /dev/random | LC_ALL=C tr -dc "[:alpha:]" | tr '[:upper:]' '[:lower:]' | head -c 32
fvhhklykzfeondjxluutncruenstapmd

Because I'm using Bash v4.4.12:

$ echo $BASH_VERSION
4.4.12(1)-release

@wombat
Copy link
Contributor

wombat commented Nov 3, 2017

@riywo I also use bash 4.4.12(1)-release and both versions work for me

@riywo
Copy link
Contributor Author

riywo commented Nov 3, 2017

Hmm. My locale is like below in my bash:

$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

@arun-gupta
Copy link
Contributor

Fixed by #200

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants