Skip to main content

Most of these responses fail to address the most common use of :.

First, this discussion is not related to any shell that is not a Bourne shellBourne shell (sh) derivative. That said, all Bourne derivative shells see true and : as the same thing. Programmers used to be encouraged to use : instead of true, because : is always a built-in while there used to be cases where true was not always a built-in.

: has two uses. It is not a synonym for #, but it has a different function. When debugging your script under a set -x, lines where # is used are dropped by the parser and totally ignored, whereas lines with : are parsed and evaluated. This is really useful in debugging since under -x those linelines are shown and their value after evaluation are displayed. It is like putting print statements in your code that only show under -x mode. Be careful with the values after the : since they are real code and the side-effects can affect your program.

Most of these responses fail to address the most common use of :.

First, this discussion is not related to any shell that is not a Bourne shell derivative. That said, all Bourne derivative shells see true and : as the same thing. Programmers used to be encouraged to use : instead of true because : is always a built-in while there used to be cases where true was not always a built-in.

: has two uses. It is not a synonym for # but has a different function. When debugging your script under a set -x, lines where # is used are dropped by the parser and totally ignored, whereas lines with : are parsed and evaluated. This is really useful in debugging since under -x those line are shown and their value after evaluation are displayed. It is like putting print statements in your code that only show under -x mode. Be careful with the values after the : since they are real code and the side-effects can affect your program.

Most of these responses fail to address the most common use of :.

First, this discussion is not related to any shell that is not a Bourne shell (sh) derivative. That said, all Bourne derivative shells see true and : as the same thing. Programmers used to be encouraged to use : instead of true, because : is always a built-in while there used to be cases where true was not always a built-in.

: has two uses. It is not a synonym for #, but it has a different function. When debugging your script under a set -x, lines where # is used are dropped by the parser and totally ignored, whereas lines with : are parsed and evaluated. This is really useful in debugging since under -x those lines are shown and their value after evaluation are displayed. It is like putting print statements in your code that only show under -x mode. Be careful with the values after the : since they are real code and the side-effects can affect your program.

typo in effect / affect and other changes to get above the 6 char requirement
Source Link

Most of these responses fail to address the most common use of :.

First, this discussion is not related to any shell that is not a Bourne shell derivative. That said, all Bourne derivative shells see true and : as the same thing. Programmers used to be encouraged to use : instead of true because : is always a built-in while there used to be cases where true was not always a built-in.

: has two uses. It is not a synonym for # but has a different function. When debugging your script under a set -x, lines where # is used are dropped by the parser and totally ignored but, whereas lines with : are parsed and evaluated. This is really useful in debugging since under -x those line are shown and their value after evaluation are displayed. It is like putting print statements in your code that only show under -x mode. Be careful with the values after the : since they are real code and the side-effects can effectaffect your program.

Most of these responses fail to address the most common use of :.

First, this discussion is not related to any shell that is not a Bourne shell derivative. That said, all Bourne derivative shells see true and : as the same thing. Programmers used to be encouraged to use : instead of true because : is always a built-in while there used to be cases where true was not always a built-in.

: has two uses. It is not a synonym for # but has a different function. When debugging your script under a set -x, lines where # is used are dropped by the parser and totally ignored but lines with : are parsed and evaluated. This is really useful in debugging since under -x those line are shown and their value after evaluation are displayed. It is like putting print statements in your code that only show under -x mode. Be careful with the values after the : since they are real code and can effect your program.

Most of these responses fail to address the most common use of :.

First, this discussion is not related to any shell that is not a Bourne shell derivative. That said, all Bourne derivative shells see true and : as the same thing. Programmers used to be encouraged to use : instead of true because : is always a built-in while there used to be cases where true was not always a built-in.

: has two uses. It is not a synonym for # but has a different function. When debugging your script under a set -x, lines where # is used are dropped by the parser and totally ignored, whereas lines with : are parsed and evaluated. This is really useful in debugging since under -x those line are shown and their value after evaluation are displayed. It is like putting print statements in your code that only show under -x mode. Be careful with the values after the : since they are real code and the side-effects can affect your program.

added 38 characters in body
Source Link
rahmu
  • 20.6k
  • 30
  • 90
  • 128

Most of these responses fail to address the most common use of ::. 

First, this discussion is not related to any shell that is not a Bourne shell derivative. That said, all Bourne derivative shells see truetrue and :: as the same thing. Programmers used to be encouraged to use :: instead of truetrue because :: is always a built-in while there used to be cases where truetrue was not always a built-in.

:: has two uses. It is not a synonym for ## but has a different function. When debugging your script under a set -xset -x, lines where ## is used are dropped by the parser and totally ignored but lines with :: are parsed and evaluated. This is really useful in debugging since under -x-x those line are shown and their value after evaluation are displayed. It is like putting printprint statements in your code that only show under -x-x mode. Be careful with the values after the :: since they are real code and can effect your programmprogram.

Most of these responses fail to address the most common use of :. First, this discussion is not related to any shell that is not a Bourne shell derivative. That said, all Bourne derivative shells see true and : as the same thing. Programmers used to be encouraged to use : instead of true because : is always a built-in while there used to be cases where true was not always a built-in.

: has two uses. It is not a synonym for # but has a different function. When debugging your script under a set -x, lines where # is used are dropped by the parser and totally ignored but lines with : are parsed and evaluated. This is really useful in debugging since under -x those line are shown and their value after evaluation are displayed. It like putting print statements in your code that only show under -x mode. Be careful with the values after the : since they are real code and can effect your programm.

Most of these responses fail to address the most common use of :. 

First, this discussion is not related to any shell that is not a Bourne shell derivative. That said, all Bourne derivative shells see true and : as the same thing. Programmers used to be encouraged to use : instead of true because : is always a built-in while there used to be cases where true was not always a built-in.

: has two uses. It is not a synonym for # but has a different function. When debugging your script under a set -x, lines where # is used are dropped by the parser and totally ignored but lines with : are parsed and evaluated. This is really useful in debugging since under -x those line are shown and their value after evaluation are displayed. It is like putting print statements in your code that only show under -x mode. Be careful with the values after the : since they are real code and can effect your program.

Source Link
cdr
  • 159
  • 1
  • 2
Loading