Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found AWK=@AWK@ while reading sh script, it's something like AWK=$(which awk), but it's not working. So can anyone explain this ?

Script :

#!/bin/sh -
# makelist.sh: Automatically generate header files...

USAGE="Usage: $0 -n|-h|-e|-fc|-fh|-bc|-bh|-m <filenames>"

if [ "x$1" = "x" ]
    echo $USAGE 1>&2
    exit 1

    set - `echo $FILES | sed -e 's/\\./_/g'`
    hdr="_h_`basename $1`"
    cat $FILES | $AWK '
        BEGIN {
            printf("/* Automatically generated file, do not edit */\n");
            printf("#ifndef %s\n#define %s\n", "'$hdr'", "'$hdr'");
        /\(\):/ {
            pr = substr($2, 1, 2);
            if (pr == "vi" || pr == "em" || pr == "ed") {
                # XXXMYSQL: support CRLF
                name = substr($2, 1, index($2,"(") - 1);
share|improve this question
Can you maybe show a larger part of the script? – Bernhard Apr 12 '13 at 5:31
Updated the some script content which related to question.. – Rahul Patil Apr 12 '13 at 5:40
up vote 5 down vote accepted

It says # makelist.sh: Automatically generate header files....

It probably means some other program is going to edit the shell script and replace the placemarker @AWK@ with the real path to awk, like /usr/bin/awk.

share|improve this answer
but why they should do this complex way ? – Rahul Patil Apr 12 '13 at 6:13
I don't really see a good reason for that, but some people do it. The right and portable way to find the path for a command is in my opinion command -v awk. – Teresa e Junior Apr 12 '13 at 6:17
command -v awk seem too faster than which awk – Rahul Patil Apr 12 '13 at 6:28
your ans seems to me approximately correct not 100%, waiting for other answers. Are you work in creating this stuff like configure makefile in source code package, that why you are saying Or you just jugging this ? – Rahul Patil Apr 12 '13 at 6:30
I have done some Debian packaging already, and I saw @word@ as a placemark a few times and used it myself once to refer to a list of files that was going to be created during the make process. – Teresa e Junior Apr 12 '13 at 6:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.