I have a cygwin bash scripts that works:
#!/bin/sh cd myc cp Stats.txt Stats.txt.cpy; cat Stats.txt.cpy | sort -n -k1 | gawk \'{sum+=$2; print $0,sum}\' > St
It was a path issue.
You need to set path in the script - otherwise it uses a different "non-cygwin" path and gets wrong commands.