error_print_progname - Linux


error_print_progname is a utility that prints the first argument, the program name, followed by the message specified in the second argument. This is useful for debugging programs that load other programs, such as shells or web servers.


error_print_progname [options] <program_name> <error_message>


  • -h, --help: Display help and usage information.
  • -e, --error: Exit with status 1 after printing the error message.


# Print a simple error message
error_print_progname my_program "An error occurred."

# Exit with status 1 after printing the error message
error_print_progname -e my_program "Failed to load configuration file."

# Use error_print_progname within a script
if ! command_1; then
  error_print_progname "$0" "Command 1 failed."
  exit 1

Common Issues

  • Ensure that both arguments are provided, as the command requires both a program name and an error message.
  • Avoid using error_print_progname in production environments unless necessary, as it can clutter error logs.


error_print_progname can be used with other tools such as:

  • logger: Log the error message to the system log.
  • stderr: Print the error message to the standard error stream.

Related Commands

  • echo: Print a message to the standard output stream.
  • logger: Log messages to the system log.