Skip to content

Commit 4206e6d

Browse files
committed
Completed task with ls-commands
1 parent 4350f48 commit 4206e6d

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ if [[ "${script_dir}" != "$(pwd)" ]]; then
1212
fi
1313

1414
# TODO: Write a command to list the files and folders in this directory.
15+
ls
1516
# The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more.

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

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

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
set -euo pipefail
44

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.
6+
ls -R
67
# The output should be a list of names including: child-directory, script-01.sh, helper-1.txt (and more).
78
# The formatting of the output doesn't matter.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ touch "${script_dir}/child-directory/helper-3.txt"
1414
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.
17+
ls -lt child-directory
1718
# The output should be a list of names in this order, one per line: helper-3.txt, helper-1.txt, helper-2.txt.
1819

1920

2021
echo "Second exercise (sorted oldest to newest):"
2122

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

0 commit comments

Comments
 (0)