If I have the following line in a bash script, it works fine:

CoDescDate=$(awk -F"\t" '{print $22}' $1)

If I embed the above line in a function that is within the same bash script, the script seems to hang at the point of invoking the function.

pay_ending_date () {
	CoDescDate=$(awk -F"\t" '{print $22}' $1)
}

How I'm calling the function:

pay_ending_date

I don't understand why it works when run directly from the script but doesn't work when embedded inside a function?

How I'm calling the function:

pay_ending_date

I don't understand why it works when run directly from the script but doesn't work when embedded inside a function?

The call is missing the parameter

pay_ending_date $1

or

pay_ending_date "filename"

oh my god, I feel like an idiot! Thanks for the help, that seems to have fixed it!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.