K
K
Knorke_022021-01-02 20:08:02
bash
Knorke_02, 2021-01-02 20:08:02

How to write a bash script correctly?

#!/bin/bash 
apt-cdrom add
mount /dev/sr0 /media/cdrom
apt-cdrom -m add
umount /media/cdrom
apt update
apt dist-upgrade -y
apt -f install -y


This is the first serious script that I can't figure out, I can't write a script for Astra Linux. All commands work individually, but not together

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
mureevms, 2021-01-02
@mureevms

This "serious script" contains a set of simple commands. Run them in the same sequence as they run from a file and see where it fails. At the same time, pay attention to which user the script is run from and from whom you will run. You need to understand what is happening and this is the only right way. If they tell you what exactly is wrong, you will step on the same rake another time.

D
Dmitry Kovalsky, 2015-09-14
@dmitryKovalskiy

The NLog library will solve 99% of your tasks.

M
Maxim Kuznetsov, 2015-09-14
@max-kuznetsov

We are using the Enterprise Library . It allows you to implement a comprehensive solution for the project infrastructure, including logging, monitoring, status control, notifications, and a bunch of other usefulness.
The logging approach is described here .
There is also a library for ASP.NET called Elmah . There is a small article here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question