Image

Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

"File name too long" when printing a long base64 string. Why?

+0
−5

Downloading an image and encoding it into base64:

curl -o output.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/USA-San_Jose-De_Anza_Hotel-3.jpg/500px-USA-San_Jose-De_Anza_Hotel-3.jpg  
IMG_BASE64=$(base64 -w 0 output.jpg)
$IMG_BASE64

Output:

[...]gw3kYhrA4NAHJliv7x+uPYjyxvzx7HHWf/Z: File name too long

Why does it say "File name too long"?

History

1 comment thread

x-post https://unix.stackexchange.com/q/800377/488245 (1 comment)

1 answer

+6
−0

You're not printing it; you're trying to invoke the Base64. And since there isn't a PATH command that matches, your system is trying to look for a script file with that nonsense name to run.

Try this last line instead:

echo "$IMG_BASE64"

Or if you don't care about output.jpg, pipe the bits through base64 and whatever else you need.

History

0 comment threads

Sign up to answer this question »