Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 482 Bytes

File metadata and controls

23 lines (16 loc) · 482 Bytes

Program name using a string name or basename

We prefer a program to be able to return its own name.

Our convention: create a function program().

The function can return a string name such as:

program() { 
        printf "%s\n" "our-demo-tool"
}

If the program may use dynamic naming, then the function can calculate a name:

program(){
        printf "%s\n" "$(basename "$0")"
}

There may be a better way; if you know a better way, please let us know.