Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My guess from the working of it is that it suppresses the output of the command

share|improve this question

3 Answers 3

up vote 2 down vote accepted

It suppresses the command entirely.

You use it commonly in batch files to either add a comment to your code (explaining to the reader what is going on) or stop a line from running - for example:

# Tell the user the results 
cat $HOME/.temp/results.txt

# This next line doesn't work
# cat $HOME/.temp/next.txt

The equivalent in DOS is to prefix the line with REM.

share|improve this answer

On the command line it's just a comment. Nothing happens.

#mkdir temp  -> yields nothing.

In a script:

#!/bin/bash

or

#!/bin/perl

has a special meaning to indicate the interpreter.

Otherwise it's used to comment out the line.

share|improve this answer
    
For the sake of completeness, a Wikipedia article on shebang (the #! sequence). –  gronostaj Oct 17 '13 at 7:12
    
I think you mean "interpreter", not "interrupter" :) –  FreudianSlip Oct 17 '13 at 7:48

It makes bash (assuming that's what you are using) and most other shells view that line as a comment, therefore, "running it" does nothing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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