I was working my way through a primer on Shell (Bash) Scripting and noticed the manpage of mkdir
describes a verbose option which displays a message when a directory is created:
-v, --verbose print a message for each created directory
It seems mkdir -v
has a pre-defined message it prints. Is there a way to print a custom message? Is there a way to permanently set a custom message instead of the default message?
From the source code for mkdir.c
, this is the section that deals with the -v
option:
case 'v': /* --verbose */
options.created_directory_format = _("created directory %s");
break;
As you can see, the string that is used is hard-coded into the source. To permanently change the message to a custom message, one can modify this section of the source code and recompile mkdir
.