11-13-2008
Try this :)
perl -e "$var=help"; -e "print unpack 'H*',$var"
68656c70
I think in your previous case the instance of the variable is lost if u r invoking the statements individually.(correct me if am wrong)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
ok guys and gals at the moment i am perplexed (prolly cuz i been looking at it to long) but here it is.
OS: sol8
perlver: 5.8.0
shell: ksh
answer must be in perl!!
issue:
when i use pack() it packs the data at the front of the requested field space. normally it wouldnt be a problem if... (1 Reply)
Discussion started by: Optimus_P
1 Replies
2. UNIX for Dummies Questions & Answers
this file i'm trying to unpack is a cloop file (1 Reply)
Discussion started by: amicrawler2000
1 Replies
3. Shell Programming and Scripting
Hello everyone.
I wrote a perl script to get the two answers from a value: x.
By this, I want to do sqrt($x) in different precision.
#!/usr/bin/perl
print "Input the initial value x:\n";
chomp($x=<STDIN>);
$comp=sqrt($x);
$float_value=pack("f", $comp);
$double_value=pack("d", $comp);... (2 Replies)
Discussion started by: Euler04
2 Replies
4. UNIX for Dummies Questions & Answers
hi all....
I'm a newbie to Shell scripting and am trying to make a simple script that can unpack a variety of .tgz , .zip, .tar or .tar.gz archives to the a current directory
i want the script to create a folder equivalent to the base name of the archive and then move the archive to a... (18 Replies)
Discussion started by: jboss
18 Replies
5. Shell Programming and Scripting
I understand that in order to run basic unix commands I would normally type at the prompt, I would have to use the following format
system(ls -l);
or
exec(ls -l);
But when I actually try to use the command, the script fails to compile and keeps telling me there is an error with this line. ... (1 Reply)
Discussion started by: userix
1 Replies
6. Shell Programming and Scripting
Is there an equivalent of perl's pack function in bash ?
Or in other words, how can I achieve the same thing in bash ?
Much appreciated. (1 Reply)
Discussion started by: NewDeb
1 Replies
7. UNIX for Advanced & Expert Users
I wondering if anybody tried already or know about the performance to process some Oracle staff from Perl.
I see it could be done by the DBI pachage (so, I guess, it is interface to the OCI, but who know how sufficiant it is..,) with all gemicks around (define, open, parce, bind,.. ), or it can... (8 Replies)
Discussion started by: alex_5161
8 Replies
8. UNIX for Dummies Questions & Answers
I am using pack/unpack to encyrpt a file.
syntax is below
#!/bin/sh
encrypt=`perl -e 'print unpack "H*","yourpassword"'` -
echo $encrypt >/file/to/store/encrypted/password
pass=`cat /file/to/store/encrypted/password`
decrypt=`perl -e 'print pack "H*",$pass'` ... (2 Replies)
Discussion started by: erinlomo
2 Replies
9. Shell Programming and Scripting
Hi I have a code like this:
sub WriteEbcdicHeader
{
my $Htimestamp=localtime();#i need to pack and unpack this
my $eheaderline = $Htimestamp;
#packing has to be done here
#unpacking has to be done after packing
print $EOUTFILE
return $eheaderline;
}
sub WriteEbcdicTrailer
{
... (5 Replies)
Discussion started by: rbathena
5 Replies
10. Shell Programming and Scripting
Are the above commands does the same job ?
same functionaliy ?
If so, why do we have three utilities for the same functinality. (1 Reply)
Discussion started by: frintocf
1 Replies
LEARN ABOUT NETBSD
netgroup_mkdb
NETGROUP_MKDB(8) BSD System Manager's Manual NETGROUP_MKDB(8)
NAME
netgroup_mkdb -- generate the netgroup database
SYNOPSIS
netgroup_mkdb [-o database] [file]
DESCRIPTION
netgroup_mkdb creates a db(3) database for the specified file. If no file is specified, then /etc/netgroup is used. This database is
installed into /var/db/netgroup.db. The file must be in the correct format (see netgroup(5)).
The options are as follows:
-o database
Put the output databases in the named file.
The databases are used by the C library netgroup routines (see getnetgrent(3)).
netgroup_mkdb exits zero on success, non-zero on failure.
FILES
/var/db/netgroup.db The current netgroup database
/var/db/netgroup.db.tmp A temporary file
/etc/netgroup The current netgroup file
SEE ALSO
db(3), getnetgrent(3), netgroup(5)
BUGS
Because netgroup_mkdb guarantees not to install a partial destination file it must build a temporary file in the same file system and if suc-
cessful use rename(2) to install over the destination file.
If netgroup_mkdb fails it will leave the previous version of the destination file intact.
BSD
May 20, 2007 BSD