Web lists-archives.com

alias appears to not work inside a called bash script

Hello all,

I have a 4 line bash script:
  alias nawk=gawk
  alias nawk
  nawk  'BEGIN {FS="^"} ; (length($0) > maxline) { maxline = length($0) ;
line=$0} ; END{print maxline, line}' $*

When I run the script I see: 
  alias nawk='gawk'
 /cygdrive/c/mybin/maxline/: line 4: nawk: command not found

It looks like the alias is properly defined but it does not appear to take

Same thing happens if I alias to awk instead of qawk.

Same thing happens if I define the alias in .bashrc (I include an echo in
bashrc to confirm that it is being invoked).

My .bashrc is not likely a factor - I empty it and the result is the same.
No carriage returns in the script or .bashrc.

I have updated everything August 5th using setup and letting all "Pending"
pkgs update so I believe I am up to date.

The funny thing is that it works ok from an interactive session, whether the
alias is explicitly defined in the session or in .bashrc.

Thank you in advance for any insights.

BTW - I just re-subscribed to cygwin 4-5 hours ago and have not seen any
mail which seems unusual based on past experience.

Michel LaBarre

Attachment: cygcheck.out
Description: Binary data

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple