title: Mongodb with bash: Creating replica sets gets 'error command line: unknown option fork use --help for help'
body: <p>I noticed Windows is having this problem, but I am running Ubuntu 13.10 (with Bash), so I don't know what is going wrong.</p>
  
  <p>Trying to set up my replica sets, I run the following command:</p>
  
  <pre><code>sudo bash &lt; create_replica_set.sh
  </code></pre>
  
  <p>or </p>
  
  <pre><code>sudo bash create_replica_set.sh
  </code></pre>
  
  <p>But my output is this:</p>
  
  <pre><code>error command line: unknown option fork
  use --help for help
  error command line: unknown option fork
  use --help for help
  error command line: unknown option fork
  use --help for help
  </code></pre>
  
  <p>Here is my <code>create_replica_set.sh</code> script:</p>
  
  <pre><code>mongod --replSet m101 --logpath "1.log" --dbpath /data/rs1 --port 27020 --oplogSize 64 --smallfiles --fork
  mongod --replSet m101 --logpath "2.log" --dbpath /data/rs2 --port 27018 --oplogSize 64 --smallfiles --fork
  mongod --replSet m101 --logpath "3.log" --dbpath /data/rs3 --port 27019 --oplogSize 64 --smallfiles --fork
  </code></pre>
  
  <p>My <code>/data/rs*</code> folders are already created.</p>
  
  <p>Oddly, this works if I copy/paste directly into terminal:</p>
  
  <pre><code>lucas@lucas-ThinkPad-W520:~/class/M101P/6week$ sudo mongod --replSet m101 --logpath "1.log" --dbpath /data/rs1 --port 27020 --oplogSize 64 --smallfiles --fork
  about to fork child process, waiting until server is ready for connections.
  forked process: 13128
  all output going to: /home/lucas/Dropbox/class/M101P/6week/1.log
  log file [/home/lucas/Dropbox/class/M101P/6week/1.log] exists; copied to temporary file [/home/lucas/Dropbox/class/M101P/6week/1.log.2014-03-18T09-35-37]
  child process started successfully, parent exiting
  </code></pre>
  
  <p>If it matters, here is my <code>/etc/mongo.conf</code> (I already tried adding <code>fork=true</code> at the end):</p>
  
  <pre><code># mongodb.conf
  
  # Where to store the data.
  
  # Note: if you run mongodb as a non-root user (recommended) you may
  # need to create and set permissions for this directory manually,
  # e.g., if the parent directory isn't mutable by the mongodb user.
  dbpath=/var/lib/mongodb
  
  #where to log
  logpath=/var/log/mongodb/mongodb.log
  
  logappend=true
  
  #port = 27017
  
  # Disables write-ahead journaling
  # nojournal = true
  
  # Enables periodic logging of CPU utilization and I/O wait
  #cpu = true
  
  # Turn on/off security.  Off is currently the default
  #noauth = true
  #auth = true
  
  # Verbose logging output.
  #verbose = true
  
  # Inspect all client data for validity on receipt (useful for
  # developing drivers)
  #objcheck = true
  
  # Enable db quota management
  #quota = true
  
  # Set oplogging level where n is
  #   0=off (default)
  #   1=W
  #   2=R
  #   3=both
  #   7=W+some reads
  #diaglog = 0
  
  # Ignore query hints
  #nohints = true
  
  # Disable the HTTP interface (Defaults to localhost:28017).
  #nohttpinterface = true
  
  # Turns off server-side scripting.  This will result in greatly limited
  # functionality
  #noscripting = true
  
  # Turns off table scans.  Any query that would do a table scan fails.
  #notablescan = true
  
  # Disable data file preallocation.
  #noprealloc = true
  
  # Specify .ns file size for new databases.
  # nssize = &lt;size&gt;
  
  # Accout token for Mongo monitoring server.
  #mms-token = &lt;token&gt;
  
  # Server name for Mongo monitoring server.
  #mms-name = &lt;server-name&gt;
  
  # Ping interval for Mongo monitoring server.
  #mms-interval = &lt;seconds&gt;
  
  # Replication Options
  
  # in master/slave replicated mongo databases, specify here whether
  # this is a slave or master
  #slave = true
  #source = master.example.com
  # Slave only: specify a single database to replicate
  #only = master.example.com
  # or
  #master = true
  #source = slave.example.com
  # in replica set configuration, specify the name of the replica set
  # replSet = setname 
  fork=true
  </code></pre>