0

This question already has an answer here:

I found a weird thing:

When I do in the console,

alias a='echo aaa'
a

I get the output aaa as expected. But when I do a script, let's name it script.sh

#!/bin/bash
alias a='echo aaa'
a

and run it by doing bash script.sh, I get script.sh: line 2: a: command not found

How is this possible and how can I fix it?

marked as duplicate by Gilles bash Oct 29 '17 at 22:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Just try to change a alias to a simple variable, like this: – Franciscon Santos Oct 29 '17 at 22:53
  • #!/bin/bash alias a='echo aaa' a – Franciscon Santos Oct 29 '17 at 22:54

Browse other questions tagged or ask your own question.