Skip to content

Commit e263848

Browse files
some improvment to the sheel tools
1 parent c285238 commit e263848

File tree

5 files changed

+5
-12
lines changed

5 files changed

+5
-12
lines changed

individual-shell-tools/ls/script-02.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ set -euo pipefail
44

55
# TODO: Write a command which lists all of the files in the directory named child-directory.
66
# The output should be a list of names: helper-1.txt, helper-2.txt, helper-3.txt.
7-
8-
ls child-directory
7+
ls "child-directory"

individual-shell-tools/ls/script-03.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ set -euo pipefail
55
# TODO: Write a command which _recursively_ lists all of the files and folders in this directory _and_ all of the files inside those folders.
66
# The output should be a list of names including: child-directory, script-01.sh, helper-1.txt (and more).
77
# The formatting of the output doesn't matter.
8-
98
ls -R

individual-shell-tools/ls/script-04.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ echo "First exercise (sorted newest to oldest):"
1515

1616
# TODO: Write a command which lists the files in the child-directory directory, one per line, sorted so that the most recently modified file is first.
1717
# The output should be a list of names in this order, one per line: helper-3.txt, helper-1.txt, helper-2.txt.
18-
19-
ls -t child-directory
18+
ls -1t child-directory
2019

2120
echo "Second exercise (sorted oldest to newest):"
2221

2322
# TODO: Write a command which does the same as above, but sorted in the opposite order (oldest first).
2423
# The output should be a list of names in this order, one per line: helper-2.txt, helper-1.txt, helper-3.txt.
25-
26-
27-
ls -tr child-directory
24+
ls -1tr child-directory

individual-shell-tools/sed/script-05.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ set -euo pipefail
66
# If a line starts with a number and a space, make the line instead end with a space and the number.
77
# So line 6 which currently reads "37 Alisha" should instead read "Alisha 37".
88
# The output should contain 11 lines.
9-
10-
sed -E 's/^([0-9]+) (.+)/\2 \1/' input.txt
9+
sed -E "s/^[[:space:]]*([0-9]+)[[:space:]]+(.*)$/\2 \1/" input.txt

individual-shell-tools/wc/script-02.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ set -euo pipefail
44

55
# TODO: Write a command to output the number of lines in the file helper-files/helper-3.txt.
66
# The output should include the number 3. The output should not include the number 19.
7-
8-
wc -l < ../helper-files/helper-3.txt
7+
wc -l ../helper-files/helper-3.txt

0 commit comments

Comments
 (0)