fix: Add syntax highlighting to code blocks

This commit is contained in:
Asocia
2021-12-08 16:31:46 +03:00
parent 871f28d44c
commit 089e6ebae8
41 changed files with 92 additions and 87 deletions

View File

@ -1,5 +1,5 @@
You can use `touch` to change modification date or time of a file:
```
```bash
touch -d 20210703 filename
# Set the times on a file to a specific date and time:
@ -7,8 +7,8 @@ touch -t YYYYMMDDHHMM.SS filename
```
or use the times from a file to set the times on a second file:
... or use the times from a file to set the times on a second file:
```
```bash
touch -r filename filename2
```

View File

@ -1,5 +1,5 @@
You can get the size of a file in bytes with:
```
```bash
stat -c %s file_name
# example
size=$(stat -c %s $myfile)

View File

@ -1,12 +1,12 @@
You can loop through the files with:
```
```bash
for f in * ; do
echo $f
done
```
If you want to loop through only directories:
```
```bash
for d in */ ; do
echo $d
done

View File

@ -1,5 +1,5 @@
You can move every file (except the hidden ones) up by one level in the hierarchy with something like this:
```
```bash
for d in */ ; do
mv $d* .
rmdir $d # optional

View File

@ -1,8 +1,8 @@
1. Redirect stdout to one file and stderr to another file:
command > out 2>error
```bash
command > out 2>error
```
2. Redirect stdout to a file `out`, and then redirect stderr to stdout:
command > out 2>&1
```bash
command > out 2>&1
```

View File

@ -1,6 +1,6 @@
You can split a string with `cut`:
```
```bash
foo="hello-world-bye-world"
bar=$(echo $foo | cut -d"-" -f2)
echo $bar