0

I have a small problem, please look next code and output, and could you tell me what I miss. #!/bin/bash

foo () {

echo "Parameter #1 is $1" 

}

foo   

my output: [user@host]$ ./test.scr test

Parameter #1 is

Parameter #1 is

1 Answer 1

1

functions get their own positional parameters from when they are called.

If you need to pass the scripts arguments to the function use foo "$@" (the quotes are important do not forget them).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.