Reusable Script

How

  1. Create a file: nano myscript.sh
  2. Add #!/bin/bash as the first line
  3. Add your commands on separate lines
  4. Save and exit (in nano: Control + X, Y, Enter)
  5. Make it executable: chmod +x myscript.sh
  6. Run it: ./myscript.sh

Try this

Create a script called hello.sh with echo "Hello from my script" inside. Make it executable and run it with ./hello.sh.

Why it works

If you've done it twice, automate it.

Open full demonstration ↗