What is the verbose option in mkdir? What is the verbose option in mkdir? shell shell

What is the verbose option in mkdir?


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.


You can create a script like this:

#/bin/bash/bin/mkdir "$@" |sed -e"s/mkdir: created directory /$USER created folder /"

Then run that script rather than mkdir.

Modify that script for each message you want to change by adding an additional -e"s/x/y" to the sed.

If you insist on it being named mkdir, then you can put it in your search path before mkdir.

I would not recommend naming it mkdir. You will only cause yourself grief for other scripts that call mkdir


If you are satisfied with a wrapper, try something like

mkdir -v "$@" | sed 's/mkdir: created directory /jar-jar: yea, weesa gotta /'

More fundamentally, the message string in mkdir is usually more or less hard-coded. However, if there is localization support, you could actually override the message catalog with your own.

For example, if your mkdir was built with gettext, you could create a new English .po file, replace the directory creation message, build a new locale, and run with that. See also http://translationproject.org/domain/coreutils.html

Depending on what you want, this is somewhere between severe overkill and insane.