diff --git a/.github/workflows/testing_shell.yml b/.github/workflows/testing_shell.yml index a86db50..0e7fe05 100644 --- a/.github/workflows/testing_shell.yml +++ b/.github/workflows/testing_shell.yml @@ -1,5 +1,5 @@ name: github action shell -on: [pull] +on: [pull_request, push] jobs: test-shell-scripting: runs-on: ubuntu-latest @@ -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 }}" diff --git a/advance/00_regex/regex.sh b/advance/00_regex/regex.sh index c7d6660..cef6af8 100755 --- a/advance/00_regex/regex.sh +++ b/advance/00_regex/regex.sh @@ -1 +1 @@ -awk -e '$1 ~ /p[o]/ {print $0}' buah.txt \ No newline at end of file +awk -e '$1 ~ /p[o]/ {print $0}' ./advance/00_regex/buah.txt \ No newline at end of file diff --git a/advance/03_user_administration/user_administration.sh b/advance/03_user_administration/user_administration.sh index 1d0b1ed..1362e74 100644 --- a/advance/03_user_administration/user_administration.sh +++ b/advance/03_user_administration/user_administration.sh @@ -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 \ No newline at end of file diff --git a/advance/04_system_logging/system_logging.sh b/advance/04_system_logging/system_logging.sh index 4937945..d77f314 100644 --- a/advance/04_system_logging/system_logging.sh +++ b/advance/04_system_logging/system_logging.sh @@ -1,4 +1,4 @@ #!/bin/bash -echo "Ini adalah custom logger" > /var/log/customlog -logger -f /var/log/customlog \ No newline at end of file +echo "Ini adalah custom logger" > test.log +logger -f test.log \ No newline at end of file