This code is from apache2 service starting script.
What does it mean?
SCRIPTNAME="${0##*/}"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It finds the name of the script being run, stripping out its directory. For instance if the script is
/etc/init.d/httpdthen this would setSCRIPTNAME=httpd.$0, or${0}, is the name of the script being executed. The##operator is used to remove any leading string that matches the pattern*/.*is a wildcard character so*/means “any string followed by a forward slash”.The effect of this is to remove any leading directory names from
$0, leaving just the name of the script.From man bash: