B
B
badman_n2020-11-01 20:40:19
bash
badman_n, 2020-11-01 20:40:19

What and how in bash?

Hello ! A strong desire to learn how to write bash scripts (I know something about programming).
Installed ubuntu on a virtual machine, there is a book, but I can not understand where to write. Need to install a development environment?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
V
Viktor Taran, 2020-11-02
@shambler81

sublime3 - it's quite good for myself, I write in vim, but to start it's much more convenient sublime
to start, learn what it is
1. learn the command
man ls
and
ls --help
understand what their difference is and hammer it into your head that this is where any work in bash begins.
In the beginning, learn what the command termination code is, and as a result,
stdin
stdout
stderr
Learn to work with these streams. without them, nowhere, but it's easier than it seems.
BUT you need to supply something to these streams, therefore you need
ls
cd
pwd - oddly enough
tail -f is needed - output in the stream
further google plus man and --help
You need to know grep perfectly - the more the better
find - also the more the better when you are going to work with arrays of files by mask.
&& - a simplified construct for returning a positive exit code
|| -not true code completion
awk is also a flow editor
sed is a flow editor
well, learn how to transfer all this art |
this is generally easy
, well, xargs as the apotheosis of this
Further, you can already learn IF, etc., etc., but in fact you will already have
1. working with the stream, you understand it and you have no problem getting the output from the sttderr part of it, make some kind of minimum condition using Simplified ifku
sed will allow you to edit this data on the fly.
Find will allow you to work with a bunch of files in Moscow, etc.
grep - without it, not a foot.
And finally, you need to understand how the rights work in Linux + owners and groups chmod chown
that launchability is an attribute
Over time, the understanding will come that Linux can only show letters and take letters, where they came from it is not particularly interested in whether it is a data print from the database, or a consequence of the PHP script.
you pointed out the interpreter file to him and fed data to him, he spat out something to you on one of the streams, you caught him and did something with him.
Further, the number of utilities does not matter, you open the man, look and work.

A
AVKor, 2020-11-01
@AVKor

Yes, you can write in any editor that has code highlighting for bash.

M
MatrixKiller, 2020-11-01
@MatrixKiller

You don't need a development environment for bash. Text editor and command line.

F
FanatPHP, 2020-11-01
@FanatPHP

In its simplest form, a bash script is just commands written in a column. something like a bat file in Windows (unless of course you are so familiar with Windows).
In general, just master bash commands for now - ls there, ln, wc, cp, cat, less, sort, grep - and over time you will learn how to write scripts
. But to edit scripts, master vim right away.

C
CityCat4, 2020-11-01
@CityCat4

Any text editor is enough. The built-in mc editor has syntax highlighting. There are no dialog debuggers - only batch debuggers (built into bash itself).
First, I advise you to carefully read man bash.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question