Skip to content

Latest commit

 

History

History

program-name-using-a-string-or-basename

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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.