Difference between revisions of "Uuencode"
From Bashlinux
Line 8: | Line 8: | ||
− | + | == Encode - Binary to text == |
|
Suppose we want to encode the `~/.Xauthority` file, the execute in command line |
Suppose we want to encode the `~/.Xauthority` file, the execute in command line |
||
Line 17: | Line 17: | ||
Note the dash at the end of the command |
Note the dash at the end of the command |
||
− | + | == Decode - Text to binary == |
|
Then copy the result string from stdin to your script as follows |
Then copy the result string from stdin to your script as follows |
||
Revision as of 01:09, 4 February 2010
uuencode
This is useful to install a binary from an script like an executable file, a zip or even an rpm. First be sure to have the needed tools installed
yum -y install sharutils
Encode - Binary to text
Suppose we want to encode the `~/.Xauthority` file, the execute in command line
/usr/bin/uuencode ~/.Xauthority -
Note the dash at the end of the command
Decode - Text to binary
Then copy the result string from stdin to your script as follows
/usr/bin/uudecode > ~/.Xauthority << 'EOF' begin 644 - M````!'\```$``3``$DU)5"U-04=)0RU#3T]+244M,0`0(581,6(<1J&_0`OE M_:%-L@$``!5L;V-A;&AO<W0N;&]C86QD;VUA:6X``3``$DU)5"U-04=)0RU# 93T]+244M,0`0(581,6(<1J&_0`OE_:%-L@`` ` end EOF
Since this commands yields the result to stdin you should redirect it to a file, specially with decoding process that will generate a binary file.