So this is my first function:
#!/bin/bash
lets_print () {
echo hello $1
}
lets_print Earth
lets_print Mars
ready to show result
user@bash$ ./demo.sh
Hello Earth
Hello Mars
And this is my 2nd function:
#!/bin/bash
lets_print () {
echo hello $1 $2
}
lets_print Earth
lets_print Mars
ready to show the second result:
user@bash$ ./demo.sh
Hello Earth
Hello Mars
Can someone please explain why they have the same result?
Right now I am thinking $1=Earth
and $2=Mars
. But I know this is wrong.