Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 18 Aug 2019, 09:18
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
rgb2hexscript
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
williams2

Joined: 14 Dec 2018
Posts: 124

PostPosted: Tue 13 Aug 2019, 19:04    Post subject:  rgb2hexscript
Subject description: not a bug
 

There is a file rgb2hexscript in bionicpup64-8.0

It's possible to use awk to convert numbers to hex.
This should do the same thing as the sh script:
Code:
echo $1 $2 $3 | awk '{printf "%02X%02X%02X\n",$1,$2,$3}'


This allows the script to be used with a pipe:
Code:
#!/bin/ash
if test $# -eq 0
then
  awk '{printf "%02X%02X%02X\n",$1,$2,$3}'
else
  echo $1 $2 $3 | awk '{printf "%02X%02X%02X\n",$1,$2,$3}'
fi

Not a bug.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1875
Location: Japan

PostPosted: Tue 13 Aug 2019, 23:15    Post subject: Re: rgb2hexscript
Subject description: not a bug
 

williams2 wrote:
It's possible to use awk to convert numbers to hex.

Possible, but why use awk?
Code:
#!/bin/ash
R=255
G=120
B=10
printf "%02X%02X%02X\n" $R $G $B
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [2 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0329s ][ Queries: 12 (0.0082s) ][ GZIP on ]