Created
April 12, 2023 17:00
-
-
Save NWuensche/1de625beadfe49e1e073feaee4e6c870 to your computer and use it in GitHub Desktop.
Bash-Script that almost writes itself. To demonstrate that bash scripts are written line by line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Program that almost writes itself into itself (but not quite), demonstrate that bash is executed line by line rather than whole file | |
CURR_FILENAME=$0 | |
echo "Hello World" | |
sed -n '5,6 p' $CURR_FILENAME >> $CURR_FILENAME #Write 4th and 5th line into same file (i.e. echo + sed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment