3

I would like to know the difference between using a Number Sign(#) and a Semicolon(;). I know that a hash is a comment and is ignored but I don't know why a semicolon is used or what it means. I see them both used in my motion.conf file as shown below.

# Tuner device to be used for capturing using tuner as source (default /dev/tuner0)
# This is ONLY used for FreeBSD. Leave it commented out for Linux
; tunerdevice /dev/tuner0

# The video input to be used (default: 8)
# Should normally be set to 0 or 1 for video/TV cards, and 8 for USB cameras
input 8

Are there any other characters that are used to make comments other than the # and ; that mean special thing?

  • ; in most programming languages means end of statement. I have never seen the used in config files unless terminating a statement block. # is genreally used to comment in many programming languages and even markup and scripts. Possibly its a clever hack somebody used but you can see the confusion it has brought up. It is best to stick to convention and change that line to use a # instead and request at source to do so also. – Piotr Kula Nov 8 '13 at 9:47
  • you should have said that as an answer. – 11chubby11 Nov 8 '13 at 9:50
  • I have seen ; used allot in config files, such as the Samba config file, along with # too. – 11chubby11 Nov 8 '13 at 9:58
  • ; is used in (som forms at least) of assembly to mark a comment. – Kenneth Nov 8 '13 at 10:00
  • Please edit your question to add "motion.conf". The question applies to all config files and that is misleading. I would edit for you but am forbidden to do so. – OyaMist Jun 6 '18 at 17:22
3

They both mean the same thing, however the pound sign is more commonly used for comments.

I would think that in your example both are used to distinguish between the explanation and the config option.

  • Pound sign: #. Appearently it has a number of diffirent names according to wikipedia; pound sign, number sign and hash. – Kenneth Nov 7 '13 at 9:35
  • In America the name pound originated from a symbol used on printers to represent lb (pound in weight). The rest of the world call it the hash sign but Canadians call it he number sign, which makes most sense because #1 is read as "number one"! Although in Europe instead of writing this is "house #5" they write "House No. 5" To make things worse # is used to denote the musical symbol sharp which is misused by Microsoft#s .NET C#. All these variants come from the fact that the # symbol it self must be one of the oldest symbols known to man kind. – Piotr Kula Nov 8 '13 at 9:56
  • Bonus info: In Denmark it's referred to as a 'square' on telephone number pads, since pound is £ and hash is used to mean marijuana resin. – Kenneth Nov 8 '13 at 9:57
  • That would mean in Holland they don't call it hash either? :) – Piotr Kula Nov 8 '13 at 9:58
1

Though both comment out the following line, there is a slight difference between the two..

# (hash) -> actual, real comment

; (Semi-colon) -> used to specify default/sample value of a configurable parameter

With ref to the OP's snippet of the conf file, /dev/tuner0 can be the default/sample value for tunerdevice.

If you require to change the value, edit the same and remove the ; Else, in order to retain for info, leave it as it is, and type your required value below.

  • Can you provide a reference for this? – Steve Robillard Jun 6 '18 at 8:25
  • @Steve I don't have an authoritative reference for that, but I have come across the usage of ; in OpenVPN config files where they are used for commenting out configuration settings that provide example values for illustration / to explain the syntax of the config parameter. Also, in the Samba config file, # is used to comment a default setting whereas ; is used when the setting differs from the default. I have updated my reply above accordingly. – sherkhan Jun 7 '18 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.