WildCard character - not able to understand

Hello,
I have one script which looks as given below ,

. ${0%/*}/init && init_job || exit 1

what I understood is ,

  1. above syntax has three commands, two on left of || and one on right of ||.

  2. ${0%/*} would generate some path.

Question.
A. What is the meaning of ${0%/*} , how to understand it.
B. what is init and init_job ?

Thanking you very much.

Hi,

${0%/*}

will delete the shortest matching pattern from $0 variable.
Adds init as it is in your script.
i guess init_job could be your function.

For ex:

A="/home/user1/dirA"
echo ${A%/*}/greet
/home/user1/greet
1 Like

Hey ,
Thanks a lot , it was a pattern matching at the string end to delete it.
Thank you very much for your time and help.