#!/bin/bash\n## Note: Only works with bash 3.x or 4.x+ ##\n## source: http://www.cyberciti.biz/tips/unix-linux-bash-shell-script-wrapper-examples.html\n\n# Instead of using /bin/ping in order to get real ‘ping’, you can use the command shell bultiin:\n# command ping --> Run command with arguments ignoring any shell function named command. \n# http://ss64.com/bash/command.html\n\n\n_getdomainnameonly(){\nlocalh="$1"\nlocalf="${h,,}"\n# remove protocol part of hostname\nf="${f#http://}"\nf="${f#https://}"\nf="${f#ftp://}"\nf="${f#scp://}"\nf="${f#scp://}"\nf="${f#sftp://}"\n# remove username and/or username:password part of hostname\nf="${f#*:*@}"\nf="${f#*@}"\n# remove all /foo/xyz.html*\nf=${f%%/*}\n# show domain name only\necho"$f"\n}\n \nping(){\nlocalarray=($@)# get all args in an array\nlocallen=${#array[@]}# find the length of an array\nlocalhost=${array[$len-1]}# get the last arg\nlocalargs=${array[@]:0:$len-1}# get all args before the last arg in $@ in an array\n#local _ping="/bin/ping"\nlocalc=$(_getdomainnameonly "$host")\n["$t" !="$c"]&&echo"Sending ICMP ECHO_REQUEST to \\"$c\\"..."\n# pass args and host\n#$_ping $args $c # improving script\ncommand ping $args$c\n}\n \nhost(){\nlocalarray=($@)\nlocallen=${#array[@]}\nlocalhost=${array[$len-1]}\nlocalargs=${array[@]:0:$len-1}\n#local _host="/usr/bin/host"\nlocalc=$(_getdomainnameonly "$host")\n["$t" !="$c"]&&echo"Performing DNS lookups for \\"$c\\"..."\n#$_host $args $c\ncommand host $args$c\n}\n \n