Skip to content

Commit 3d160d2

Browse files
committed
Python Shebang: TR Feedback
1 parent 2a3eb9c commit 3d160d2

File tree

5 files changed

+17
-48
lines changed

5 files changed

+17
-48
lines changed

python-shebang/README.md

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Should You Put the Unix Shebang (#!) in Python Scripts?
1+
# Executing Python Scripts With a Shebang
22

3-
This folder holds the code for the Real Python Should You Put the Unix Shebang (#!) in Python Scripts? tutorial.
3+
This folder holds the code for the Real Python tutorial entitled [Executing Python Scripts With a Shebang](https://realpython.com/python-shebang/).
44

55
## Sample Scripts
66

@@ -9,16 +9,8 @@ This folder holds the code for the Real Python Should You Put the Unix Shebang (
99
Command:
1010

1111
```shell
12-
$ ./hello.py
13-
Hello from Python!
14-
```
15-
16-
Source:
17-
18-
```python
19-
#!/usr/bin/env python
20-
21-
print("Hello from Python!")
12+
$ ./hello.py
13+
Hello, World!
2214
```
2315

2416
### Perl
@@ -27,15 +19,7 @@ Command:
2719

2820
```shell
2921
$ ./hello.pl
30-
Hello from Perl!
31-
```
32-
33-
Source:
34-
35-
```perl
36-
#!/usr/bin/env perl
37-
38-
print "Hello from Perl!\n";
22+
Hello, World!
3923
```
4024

4125
### JavaScript
@@ -44,15 +28,7 @@ Command:
4428

4529
```shell
4630
$ ./hello.js
47-
Hello from JavaScript!
48-
```
49-
50-
Source:
51-
52-
```javascript
53-
#!/usr/bin/env node
54-
55-
console.log("Hello from JavaScript!")
31+
Hello, World!
5632
```
5733

5834
### Java
@@ -61,18 +37,7 @@ Command:
6137

6238
```shell
6339
$ ./hello.j
64-
Hello from Java!
65-
```
66-
67-
Source:
68-
69-
```java
70-
#!/usr/bin/env -S java --source 11
71-
public class Hello {
72-
public static void main(String[] args) {
73-
System.out.println("Hello from Java!");
74-
}
75-
}
40+
Hello, World!
7641
```
7742

7843
## Custom Interpreter
@@ -86,11 +51,12 @@ $ source venv/bin/activate
8651
(venv) $ python -m pip install .
8752
```
8853

89-
Execute sample scripts through the esoteric language interepreter while using the virtual environment:
54+
Execute sample scripts through the esoteric language interpreter while using the virtual environment:
9055

9156
```shell
9257
(venv) $ cd scripts/
9358
```
59+
9460
### Towers of Hanoi
9561

9662
```shell
@@ -233,6 +199,8 @@ Execute sample scripts through the esoteric language interepreter while using th
233199

234200
### ROT-13
235201

202+
This is an interactive script that will expect you to provide input from your keyboard:
203+
236204
```shell
237205
(venv) $ ./rot13.b
238206
This text will be encrypted.

python-shebang/hello.j

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env -S java --source 11
2+
23
public class Hello {
34
public static void main(String[] args) {
4-
System.out.println("Hello from Java!");
5+
System.out.println("Hello, World!");
56
}
67
}

python-shebang/hello.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env node
22

3-
console.log("Hello from JavaScript!")
3+
console.log("Hello, World!")

python-shebang/hello.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env perl
22

3-
print "Hello from Perl!\n";
3+
print("Hello, World!\n");

python-shebang/hello.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

3-
print("Hello from Python!")
3+
print("Hello, World!")

0 commit comments

Comments
 (0)