Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8216839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:16:17+00:00 2026-06-07T12:16:17+00:00

Let’s imagine we have some script ‘m12’ (I’ve just invented this name) that runs

  • 0

Let’s imagine we have some script ‘m12’ (I’ve just invented this name) that runs
on Linux computers. If it is situated in your $PATH, you can easily run it
from the console like this:

m12 

It will work with the default parameters. But you can customize the work of
this script by running it something like:

m12 --enable_feature --select=3

It is great and it will work. But I want to create a config file ~/.m12rc so I
will not need to specify --enable_feature --select=3 every time I run it.
It can be easily done.

The difficult part is starting here.

So, I have ~/.m12rc config file, but I what to start m12 without parameters that
are stored in that config file. What is the Unix way to do this? Should I run
script like this:

m12 --ignore_config

or there is better solution?

Next. Let’s imagine I have a config file ~/.m12rc and I want some parameters from that
file, but want to change them a bit. How should I run the script and how the
script should work?

And the last question. Is it a good idea for script to first look for .m12rc
in the current directory, then in ~/ and then in /etc?

I’m asking all these questions because I what to implement config files in my
small script and I want to make the correct decisions about the design.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:16:19+00:00Added an answer on June 7, 2026 at 12:16 pm

    The book ‘The Art of Unix Programming’ by E S Raymond discusses such issues.

    You can override the config file with --config-file=/dev/null.

    You would normally use the order:

    • System-wide configuration (/etc/m12/m12rc, or just /etc/m12).
    • User’s personal configuration (~/.m12rc)
    • Local directory configuration (./.m12rc)
    • Command-line options

    with each later-listed item overriding earlier listed items. You should be able to specify the configuration file to read on the command line; arguably, that should be given precedence over other options. Think about --no-system-config or --no-user-config or --no-local-config. Many scripts do not warrant a system config file. Most scripts I’ve developed would not use both local config and user config. But that’s the way my mind works.

    The way I package standard options is to have a script in $HOME/bin (say m12a) that does it for me:

    #!/bin/sh
    exec m12 --enable_feature --select=3 "$@"
    

    If I want those options, I run m12a. If I want some other options, I run raw m12 with the requisite options. I have multiple hundreds of files in my personal bin directory (about 500 on my main machine, a Mac; some of those are executables, but many are scripts).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that I have a set of relations that looks like this: relations
Let's say I have some json like this in mongo: {n:5} and a java
Let's say I want to have some kind of a cache that did something
Let's imagine that we have ecommerce website that suggests 3 way for user registration:
Let's imagine that we have OrderController controller with three actions/pages: orderDetailsAction , orderHistoryAction ,
Let me explain best with an example. Say you have node class that can
Let's say that I have a SQLite database that I create in a separate
Let's say I have a sortable list like this: $(.song-list).sortable({ handle : '.pos_handle', axis
Let's say I have a string like this: var str = /abcd/efgh/ijkl/xxx-1/xxx-2; How do
Let's say on a page I have alot of this repeated: <div class=entry> <h4>Magic:</h4>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.