example bash file:
save the following in a file called print.sh
#!/bin/bash
echo "$@"
and then :
chmod +x print.sh
./print.sh hello world
Note that, all the parameters you pass to print.sh will be passed to echo, this because of "$@"
Subscribe to:
Post Comments (Atom)
2 comments:
One question: Do you mean that in the above example you passed 2 parameters "hello" and "world"?
Yes.
Try this
#!/bin/bash
echo "$1"
and then:
./print.sh hello world
The result will be just "hello"
Post a Comment