You need to make it in to a bash script, then execute the script.
- Create a new text file, e.g.
script.sh. - Add a shebang as the first line:
#!/usr/bin/env bash. - Paste the commands below the shebang.
- Ensure the file uses Unix (LF) line endings.
- Make it executable:
chmod +x script.sh. - Run it:
./script.sh.
Google for more info.