954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

calling awk from bash function not working

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?

spowel4
Light Poster
32 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

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"
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
 

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

spowel4
Light Poster
32 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You