Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2912

MacのターミナルでBase64をデコードすると出力の末尾に"%"が挿入される

$
0
0
事象 % echo $SHELL /bin/zsh % echo -n M | base64 TQ== % echo TQ== | base64 -d M% 対応策① ZshではなくBashで実行すると%が表示されなくなる。 (出力に改行が挿入されないので,見やすさのためデコードした後echoを入れています) % bash The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit https://support.apple.com/kb/HT208050. bash-3.2$ echo TQ== | base64 -d && echo M bash-3.2$ 対応策② シェルを変えたくない場合は,コマンド置換を使ってもできる。 この場合は自動改行もされる。 % echo $SHELL /bin/zsh % echo $(echo TQ== | base64 -d) M # あるいは % echo $(base64 -d <<< TQ==) M 参考:linux - Base64 decoding has "%" at the end of the result sometimes. Is it the result supposed to be? Any solution to that? - Stack Overflow

Viewing all articles
Browse latest Browse all 2912

Trending Articles