Hi, I'm very happy to help out here.
You want to type the program exactly like this, and lets call it myping.sh
and you put it in /bin so its in your path.
ping -c 1 "$1" >/dev/null
Then to use it in another script you would do this
if myping.sh 192.168.1.1; then
echo "The address 192.168.1.1 is alive"
As a side note, anything you place inside the [ ] has to be "test" syntax.
See "man test" for more information.
The difference is that in the myping.sh program it returns exit status 0 or 1. In your
program you were attempting to print "0" or "1" to stdout, which is not the same thing.