Concept Flow - First Bash script
Write script file
Make script executable
Run script in terminal
See output printed
Script ends
This flow shows how you write a bash script, make it runnable, execute it, and see the output.
#!/bin/bash echo "Hello, world!"
| Step | Action | Command/Code | Output |
|---|---|---|---|
| 1 | Write script file | #!/bin/bash echo "Hello, world!" | |
| 2 | Make script executable | chmod +x script.sh | |
| 3 | Run script | ./script.sh | Hello, world! |
| 4 | Script ends | Script finishes running |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 | Final |
|---|---|---|---|---|---|
| script file | none | created with code | executable permission set | executed and output shown | exists on disk |
#!/bin/bash at top tells system to use bash Write commands in script file (e.g., echo) Make script executable with chmod +x Run script with ./scriptname Script prints output and ends