Reusable Script
How
- Create a file:
nano myscript.sh - Add
#!/bin/bashas the first line - Add your commands on separate lines
- Save and exit (in nano: Control + X, Y, Enter)
- Make it executable:
chmod +x myscript.sh - 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.