Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: memperbaiki actions dan script serta menambahkan materi #37

Merged
merged 8 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/testing_shell.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: github action shell
on: [pull]
on: [pull_request, push]
jobs:
test-shell-scripting:
runs-on: ubuntu-latest
Expand All @@ -12,9 +12,9 @@ jobs:
- run: echo "jalan pada ${{ runner.os }}"
- name: list dari direktori shell scripting
run: |
d=$(date + "%Y-%m-%d")
d=$(date "+%Y-%m-%d")
file="/tmp/test.txt.$$" && touch --date "$d" "$file"
echo $file && find . -iname "*.sh" -type f -newer $file > output.txt
for i in $(cat output.txt); do chmod +x $i && sh $i; done
echo $file && find . -type d \( -path ./playground -o -path ./simple_project -o -path ./basic -o -path ./advance/03_user_administration -o -path ./advance/01_advance_file -o -path ./usefull_command \) -prune -o -iname "*.sh" -type f -newer $file > output.txt
for i in $(cat output.txt); do if [ -d "$i" ]; then echo "$i adalah folder."; elif [ -f "$i" ]; then chmod +x "$i" && bash "$i"; else echo "$i tidak ditemukan atau bukan file/folder."; fi; done

- run: echo "status ${{ job.status }}"
2 changes: 1 addition & 1 deletion advance/00_regex/regex.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
awk -e '$1 ~ /p[o]/ {print $0}' buah.txt
awk -e '$1 ~ /p[o]/ {print $0}' ./advance/00_regex/buah.txt
8 changes: 4 additions & 4 deletions advance/03_user_administration/user_administration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ check_os() {
esac
}

if ["$(dpkg -l | awk '/sudo/ {print }' | wc -l)" -le 1]; then
check_os()
sleep 5
if [ "$(dpkg -l | awk '/sudo/ {print }' | wc -l)" -le 1 ];
then
check_os
fi

echo -e "create new user kyora ..."
useradd kyora && echo -e "1\n\1n" | passwd kyora
sleep 2

echo -e "add kyora to sudoers ..."
usermod -aG sudo kyora
4 changes: 2 additions & 2 deletions advance/04_system_logging/system_logging.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

echo "Ini adalah custom logger" > /var/log/customlog
logger -f /var/log/customlog
echo "Ini adalah custom logger" > test.log
logger -f test.log
Loading