Skip to content

Commit 6dd444a

Browse files
committed
Update linux-command-line.md
1 parent 0cdee73 commit 6dd444a

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

content/posts/linux-command-line.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ description: |
88
And i will cover the basics of shell scripting.
99
1010
summary: "In this guide i will be covering the linux command line basics"
11-
ShowToc: true
12-
TocOpen: true
11+
ShowToc: false
1312
ShowBreadCrumbs: true
1413
---
1514

@@ -165,9 +164,12 @@ But you can be sure that all major Linux distros come with the binaries of those
165164

166165
## Shebangs
167166

168-
description of shebangs here.
167+
You will often encounter shell scripts starting with ``#!/bin/bash``, the ``#!`` is called a shebang. It is used to specify which interpreter will be used to run the script.
168+
So if your script uses bash specific scripting syntax, then you put a bash shebang on the first line of your script.
169+
If you want your script to be posix compatible so it can run on other unix like systems that don't have bash, then you use the sh shebang.
170+
The sh shell is compatible with alot more unix like operating systems than just linux, making your scripts more portable at the cost of bash specific scripting features.
169171

170-
### Bash Shebangs
172+
### Bash Compatible:
171173

172174
<table>
173175
<tr>
@@ -217,7 +219,7 @@ description of shebangs here.
217219
</tr>
218220
</table>
219221

220-
### Posix Shebangs
222+
### Posix Compatible:
221223

222224
<table>
223225
<tr>
@@ -267,6 +269,14 @@ description of shebangs here.
267269
</tr>
268270
</table>
269271

272+
### Conclusion:
273+
274+
Just use ``#!/bin/bash`` for linux bash scripts.
275+
276+
Just use ``#!/usr/bin/env bash`` for cross platform bash scripts.
277+
278+
Just use ``#!/bin/bash`` or ``#!/usr/bin/env sh`` for cross platform posix scripts.
279+
270280
## Basics of bash and scripting
271281

272282
comming soon...

0 commit comments

Comments
 (0)