bash passing positional parameters in function -


i have small problem, please next code , output, , tell me miss. #!/bin/bash

foo () {  echo "parameter #1 $1"   }  foo    

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

parameter #1

parameter #1

functions own positional parameters when called.

if need pass scripts arguments function use foo "$@" (the quotes important not forget them).


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -