Это можно сделать с помощью функции или с помощью && В приведенных ниже примерах устанавливается Zabbix и создается файл со строкой внутри.
Пример:
#!/bin/bash
# Create Function:
installZabbix(){
cd /usr/src/zabbix-4.2.4;
./configure --enable-agent;
make install;
cd /usr/src/;
>file;
echo "Hi, this is a file." >>file;
}
# Call the function:
installZabbix
или:
#!/bin/bash
cd /usr/src/zabbix-4.2.4 &&./configure --enable-agent && make install && cd /usr/src && >file && echo "Hi, this is a file." >>file