Results 1 to 9 of 9

Thread: # and ; meaning in Linux.

  1. #1
    Join Date
    Dec 2009
    Beans
    116

    # and ; meaning in Linux.

    hi,
    In any configuration file if we want to comment that particular line Linux allow " # " sign. Where as there is another character " ; " which is also use in configuration files like in smb.conf

    I shall be glad if you may guide me what " ; " function of this character is ?

    Thanks.

  2. #2
    Join Date
    Oct 2004
    Location
    33.4N -112.1W
    Beans
    2,497
    Distro
    Ubuntu Budgie

    Re: # and ; meaning in Linux.

    When the option is commented with ";" it means the setting differs from the default program behavior.
    /path/to/Truth

  3. #3
    Join Date
    Dec 2009
    Beans
    116

    Re: # and ; meaning in Linux.

    well it is just like comments.The system not read that line when it execute
    Example /etc/network/interfaces

    Code:
    # This ia a test line for assigning IP Address.
    ; address 192.168.1.10
    ; netmask 255.255.255.0
    ; gateway  192.168.1.1
    The Linux kernel will not read both line if it is inside the configuration file.If I um-comment " ; " thing works.

    So what is the difference in # and ;

  4. #4
    Join Date
    Aug 2017
    Location
    melbourne, au
    Beans
    Hidden!
    Distro
    Lubuntu Development Release

    Re: # and ; meaning in Linux.

    Which standard to use.... https://xkcd.com/927/

    GNU options are usually '--' in front of the option, unix tends to use '-' (or nothing; `ps aux`)
    GNU/Linux tends to use "#" as marking comments; BSD tends to prefer ";"

    But our systems today are a mixture of some components that started up the older BSD or unix world; plus other parts that were from GNU or Linux, thus some programs/applications use the ";" whilst others use "#" etc

    The difference is where the programmer initially came from; which "standard" or OS the developer preferred... and thus which he/she then implemented in their newer created project/application.

    The difference is just historical & which standard felt "most at home" to the developer.

    I'll refer back to the XKCD comic - https://xkcd.com/927/

  5. #5
    Join Date
    Aug 2013
    Location
    London, UK
    Beans
    423
    Distro
    Ubuntu

    Re: # and ; meaning in Linux.

    Quote Originally Posted by Xian View Post
    When the option is commented with ";" it means the setting differs from the default program behavior.
    Ah, interesting. Didn't actually know that.

    geoff

  6. #6
    Join Date
    Oct 2004
    Location
    33.4N -112.1W
    Beans
    2,497
    Distro
    Ubuntu Budgie

    Re: # and ; meaning in Linux.

    The OP referenced a specific file as an example of their question.

    In that file the following is shown below.

    It's use with that application is not expected to be found globally.

    Code:
    # Some options that are often worth tuning have been included as# commented-out examples in this file.
    #  - When such options are commented with ";", the proposed setting
    #    differs from the default Samba behaviour
    #  - When commented with "#", the proposed setting is the default
    #    behaviour of Samba but the option is considered important
    #    enough to be mentioned here
    Last edited by Xian; May 3rd, 2021 at 04:51 PM.
    /path/to/Truth

  7. #7
    Join Date
    Dec 2009
    Beans
    116

    Re: # and ; meaning in Linux.

    Thanks a lot for the valuable information. In short we can say that " # " or " ; " have same characteristics .

  8. #8
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,701

    Re: # and ; meaning in Linux.

    Quote Originally Posted by gardenair View Post
    Thanks a lot for the valuable information. In short we can say that " # " or " ; " have same characteristics .
    That's not at all universally true. Many configuration files use just one or the other. I think that being able to use either in a configuration file is unusual.

  9. #9
    Join Date
    Oct 2017
    Location
    /dev/sdx
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: # and ; meaning in Linux.

    For me;
    The ";" this is to declare a function to be functional. sensitive type of function.
    while "#" this is to avoid the string to be functional in short non-functional
    That is in my opinion.
    But in IRC this "#" can be a channel #ubuntu
    corn ubuntuforums community.
    Open Source platform where the real world of human is here. Click here for Solve thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •