awk command line arguments not taking

# more minusf.awk

#!/bin/awk -f
BEGIN {
        FS=":";
}
{
        if ( $2 == "" ) {
                print $1 ": no password!";
        }
}

# ./minusf.awk aa aa aa aa
awk: can't open aa

Please help

Are you in the correct directory ?

Please use code tags for multiline output, not icode tags.
As i undertand awk so far, i'd assume 'aa aa aa aa' is taken as a list of input files, rather than a stream as you expect.

Hope this helps and thank you.

Make use of these variables

  
       Gawk's built-in variables are:

       ARGC        The  number  of command line arguments (does not include options to gawk


       ARGIND      The index in ARGV

       ARGV        Array of command line arguments.  The array is indexed from 0 to ARGC
                   cally changing the contents of ARGV can control the files used for data.

Example

akshay@Aix:/tmp$ cat test.awk 
BEGIN{
	for(i=1; i<ARGC; i++)
	  printf("ARG[%d] = %s\n",i,ARGV)
}
akshay@Aix:/tmp$ awk -f test.awk user password etc etc
ARG[1] = user
ARG[2] = password
ARG[3] = etc
ARG[4] = etc

Would this work (recent bash needed):

./minusf <<< "aa:aa:aa:aa"

?

My understanding goes that when I use the $1 ... in the code, the values for thiese var's / parameters ($1...) should be given as arguments while running the program

and @Kumaran , I am in the correct direcorty.
@sea i'd assume 'aa aa aa aa' would be taken as a single string, also these are not the files rather just values for the parameters
@Rudic using ./minusf <<< "aa:aa:aa:aa" I have'nt got any output

However I still did not get any ouput.

# ./minusf.awk 'aa aa aa aa'
awk: can't open aa aa aa aa

Is this a homework assignment? Homework assignments must be posted in the Homework and Coursework Questions forum and you need to completely fill out the homework template before we can help you with your assignment.

Your understanding is incorrect. You are mixing shell command line parameter parsing with awk field parsing and coming up with something that doesn't work for either.

And, if you want your awk script to read /etc/passwd , you have to tell your awk script to read it; not just assume that awk can magically guess that that is the file you are trying to process.

Furthermore, I don't see anything in your code that makes any attempt to identify a line in the password file that will match any user you want to examine.