"$*" in a bash shell refers to the list of all (0 or more) white-space separated tokens that follow the name of the shell script on the command line that invokes the shell script. Things that are within quotes are treated as a single "token", and can include any sort of white-space (even LF), but all spaces and tabs between tokens are discarded once the tokenization is done, and the shell script gets the list of tokens as $* -- for example:
That's the same behavior you get with @ARGV in perl scripts.$ cat test.sh for i in $* do echo ==$i== done $ source test.sh one two three ==one== ==two== ==three==
A shell command line cannot pass a C structure, except when either (a) the C structure is properly quoted and escaped so that the shell sees it as a single token containing literal characters, or (b) the C structure happens to be a single string of "non-shell-magic" characters -- no internal spaces or other things that the shell would interpret in some special way (e.g. angle brackets, ampersand, semicolon, etc). Either way, $* and @ARGV should be equivalent.
Elsewhere you said:
Basically the calling program passes 128 bytes of data. It so happens that the fields in the structure are strings and padded with spaces but there are no delimiters other than byte offset from the beginning. So I know the data is there I just don't know how to get at it from within perl because I don't know how to treat the command line as a large blob of binary data.Basically the command line would look like this.
program.pl <128 bytes of data>
So, you are not able to change the calling program, but you want your "program.pl" to replace an existing C program that previously occupied the initial slot in that command line, and you believe that the C program is treating its command line arg(s) differently from how Perl treats @ARGV -- is that it? Well, maybe the C program is treating its command-line args differently... do you have the C source code to check on that? But I don't think the "(argc,argv)" things that the C program gets from the command line can be any different from what Perl gets in @ARGV
I suspect we could be more help, but IMHO, the problem as presented so far has invalid assumptions and insufficient detail.
(updated to fix syntax in middle paragraph)
In reply to Re: Perl equivelant to bash '$*'
by graff
in thread Perl equivelant to bash '$*'
by tillywern
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |