#!/linuxSucks/Bash files

Jan 25, 2020

Bash files are helpful to automate task in your system, for simple tasks like installing o compile software from source to complicated task.

Here is a simple example of bash file, here will do a update, install the updates then it will download a source for micro text editor and install it. This example is for debian-based systems.

#!/bin/bash

# update
sudo apt update

# install update
sudo apt dist-upgrade -y

# install curl if is not present in the system
sudo apt install -y curl

# download micro script
curl https://getmic.ro | bash

# copy micro script to bin forlder
sudo cp micro /usr/bin

# delete micro script from current folder
rm micro

Before running the script, needs to be executable

sudo chmod +x test.sh

Then you can run it like

./test.sh

If everything went well you will see all the process in the terminal and get the normal prompt in the terminal.

Home  Linux  Notes  Blog Spot