Skip to content

Commit

Permalink
Update linux-assesment.md (Ebazhanov#2864)
Browse files Browse the repository at this point in the history
Q59: redirection does not invalidate return code but bash builtin `[[ -e file_or_dir ]]` and `[[ -f file ]]` are better.
Q62: `grep -E` interprets extended regex not basic regex
  • Loading branch information
DiscreteLogarithm authored Dec 27, 2021
1 parent 6205275 commit 67e2432
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions linux/linux-assesment.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,10 @@ fi
```

- [ ] The code snippet cannot be improved, this is a valid way of checking for the existence of a file.
- [ ] Use Bash's built-in `[[ ]]` test conditions instead of the ls command.
- [x] The redirect to `/dev/null` will silence the return code invalidating the conditional. Removing the redirect will solve this.
- [x] Use Bash's built-in `[[ ]]` test conditions instead of the ls command.
- [ ] The redirect to `/dev/null` will silence the return code invalidating the conditional. Removing the redirect will solve this.
- [ ] The ls command will output the name of the file to the screen. Running ls in quiet mode will improve the code snippet.

**Note:** Not confident about answer. If someone knows the exact answer please contribute in this repository and mark correct answer.

#### Q60. Using a systemd-based distribution, you want to restrict the cron service from running either automatically or manually. Which command would you run?

- [ ] systemctl disable crond
Expand All @@ -509,12 +507,12 @@ isse letter drift problem, mentionned here https://access.redhat.com/discussions

#### Q62. Which option would you choose to force grep to use a basic regular expression (BRE)?

- [x] grep -E
- [ ] grep -E
- [ ] grep -B
- [ ] grep -e
- [ ] grep -G
- [x] grep -G

[Reference](https://linuxize.com/post/regular-expressions-in-grep/)
[Reference] Man page of grep command.

#### Q63. An rsyslogd filter determines which items in a log file to act on. What is it made up of?

Expand Down Expand Up @@ -581,7 +579,7 @@ isse letter drift problem, mentionned here https://access.redhat.com/discussions
echo "data" >> file.txt
```

- [ ] The first line will append the word `data` to file.txt and output it on the screen. The second line will append the word `data` only to file.txt.
- [x] The first line will append the word `data` to file.txt and output it on the screen. The second line will append the word `data` only to file.txt.
- [ ] They are the same.
- [ ] The first line will append the word `data` to file.txt and there will be no output on the screen. The second line will output the word `data` on the screen and append it to `file.txt`
- [ ] Both lines will overwrite file.txt with the word data.
Expand Down

0 comments on commit 67e2432

Please sign in to comment.