Re: 2 simple shell related questions



On 2007-10-11, babaji wrote:


Newbie alert!

Hello everyone :) . I have two simple questions regarding shell
variables. I tried looking for the answers on the net but couldn't
find an exact match.

Q1: what does $^ represent
Q2: what does $@ represent

I saw both in a makefile and searched the GNU make document which has
references to these symbols but does not explain clearly what they
stand for (or maybe I didn't get it!) . I searched on google too but
came up with not so clear results.

From what I know $ is used to get the value of a shell var, and so ^
or @ must stand for something like a special-var.

I know what $#, $0/1/2... and $* are used for but can't get an idea
about these two :)

They are not shell variables; a makefile is not a shell script. See
the documentation for make:

Automatic Variables

`$@'
The file name of the target of the rule. If the target is an
archive member, then `$@' is the name of the archive file. In a
pattern rule that has multiple targets (*note Introduction to
Pattern Rules: Pattern Intro.), `$@' is the name of whichever
target caused the rule's commands to be run.

`$^'
The names of all the prerequisites, with spaces between them. For
prerequisites which are archive members, only the member named is
used (*note Archives::). A target has only one prerequisite on
each other file it depends on, no matter how many times each file
is listed as a prerequisite. So if you list a prerequisite more
than once for a target, the value of `$^' contains just one copy
of the name.


--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.



Relevant Pages

  • Re: 2 simple shell related questions
    ... The file name of the target of the rule. ... archive member, then `$@' is the name of the archive file. ... pattern rule that has multiple targets (*note Introduction to ... A target has only one prerequisite on ...
    (comp.os.linux.misc)
  • Re: How do I deploy my Image to the Target Device?
    ... when Target Designer asked you to choose a shell ... > A hard disk drive connected to the EIDE Primary Master. ... > To make a long story short, I boot to the XPe image, FBA runs, I believe ...
    (microsoft.public.windowsxp.embedded)
  • Re: Problem with Shell command
    ... available in a cmd window but not with Shell. ... Microsoft MVP - Excel ... (email address is on the web site) ... Dim target As String ...
    (microsoft.public.excel.programming)
  • Re: Progress when shell is target of paste.
    ... What information is the drag source providing to the shell through the ... Microsoft Community Support ... >Subject: Re: Progress when shell is target of paste. ...
    (microsoft.public.win32.programmer.ole)
  • Re: Invoke Command Line (Shell Method with Winzip)
    ... I've not used the command line add-in, but I suspect your problem is ... Shell (zipIT & target & source) ... Function Zip (Target as String, ...
    (microsoft.public.access.modulesdaovba)