Skip to content

Instantly share code, notes, and snippets.

@SmugZombie
Created October 2, 2019 22:10
Show Gist options
  • Save SmugZombie/2ce3e9cdd46a6886e2babeb2803d612e to your computer and use it in GitHub Desktop.
Save SmugZombie/2ce3e9cdd46a6886e2babeb2803d612e to your computer and use it in GitHub Desktop.
#!/bin/bash
echo
echo "# arguments called with ----> ${@} "
echo "# \$1 ----------------------> $1 "
echo "# \$2 ----------------------> $2 "
echo "# path to me ---------------> ${0} "
echo "# parent path --------------> ${0%/*} "
echo "# my name ------------------> ${0##*/} "
echo "# path to me ---------------> " $(basename $0)
echo
exit
@SmugZombie
Copy link
Author

root@demo-web01:/var/www/demo/scripts# bash /var/www/demo/scripts/test.sh test helloworld=hello

# arguments called with ---->  test helloworld=hello
# $1 ---------------------->  test
# $2 ---------------------->  helloworld=hello
# path to me --------------->  /var/www/demo/scripts/test.sh
# parent path -------------->  /var/www/demo/scripts
# my name ------------------>  test.sh
# path to me --------------->  test.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment