Ash And Special Characters

Packaging/Compiling/Client Information Forums, including Author's chit chat forum and soon others.

Postby Uri » Fri Mar 02, 2007 11:24 am

Hi, all!

I have a problem with writing shell script for freesco. I need to convert url from coded view (special symbols conerted to %XY, where XY is hexadecimal code of character) to normal view.

Question: how i can add character by hexadecimal (or decimal, or octal) code in shell variable?
User avatar
Uri
Newbie
 
Posts: 12
Joined: Fri Oct 15, 2004 7:00 am

Postby Slowpoke » Fri Mar 02, 2007 1:49 pm

Code: Select all
eval VAR=`echo -ne "\xff"`
This will put decimal character 255 (hex FF) in the variable VAR. Replace '\xff' with whatever hex code you want.

You can also use octal by omitting the 'x':
Code: Select all
eval VAR=`echo -ne "\40"`
This puts octal character 40 into variable VAR.


HTH
User avatar
Slowpoke
Advanced Member
 
Posts: 233
Joined: Fri Aug 12, 2005 4:08 pm
Location: Upstate New York, USA

Postby Uri » Mon Mar 05, 2007 10:13 am

But freesco don't contains echo.
And internal ash echo don't supports -e option.
User avatar
Uri
Newbie
 
Posts: 12
Joined: Fri Oct 15, 2004 7:00 am

Postby Uri » Fri Mar 09, 2007 6:17 am

Added the "echo" binary so it now supports the -e flag and supports all of the normal inline commands.

This is from release notes from new (0.3.7) version of freesco.
Thanks!
User avatar
Uri
Newbie
 
Posts: 12
Joined: Fri Oct 15, 2004 7:00 am

Postby Lightning » Fri Mar 09, 2007 10:01 pm

Hehe, you should know that Slowpoke has been testing 037 for some time and probably forgot the echo binary is a new feature. :rolleyes:
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Postby Slowpoke » Fri Mar 09, 2007 10:48 pm

:blink: Oops...

:D Good thing 0.3.7 is released now, huh?!! :happy:

Actually, the new echo will only do octal - I just checked & tried to do hex, but it didn't work... (Unless I was trying wrong!)
User avatar
Slowpoke
Advanced Member
 
Posts: 233
Joined: Fri Aug 12, 2005 4:08 pm
Location: Upstate New York, USA

Postby Lightning » Sat Mar 10, 2007 1:07 am

Added the "echo" binary so it now supports the -e flag and supports all of the normal inline commands.

This statement may be a bit more than reality and it probably should have been
Added the "echo" binary so it now supports the -e flag and supports most/some of the normal inline commands.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA


Return to Packaging/Compiling/Client Information Forums

Who is online

Users browsing this forum: No registered users and 2 guests

cron