A Bash script is a plain text file which contains a series of commands. These commands are a mixture of commands we would normally type ouselves on the command line (such as ls or cp for example).
Writing your first, basic bash shell script. Using any text editor create a file called helloworld.sh, add the following code.
#!/bin/bash
echo "hello world"
Run your script:
bash helloworld.sh
| Folder | Description |
|---|---|
| arrays | Basics of Bash Arrays |
| simplescripts | Basics of Bash Scripting |
| tasks | Simple Bash tasks/challenges |
| scripts | Sample Scripts |
- Always use comments in your scripts
- Make a script exit when it fails
- Use double quotes to reference variables
- Use Uppercase names for environment variables and lowercase for custom variables
- Use functions in scripts

