From 3663cd0d0551c6b023a7122de169a8e3a907a65e Mon Sep 17 00:00:00 2001 From: Matheus Albino Brunhara Date: Tue, 19 Nov 2024 08:57:18 -0300 Subject: [PATCH] Adds scripts --- scripts/shell/format-xml.sh | 15 +++++++++++++++ scripts/shell/ports-in-use.sh | 3 +++ 2 files changed, 18 insertions(+) create mode 100755 scripts/shell/format-xml.sh create mode 100755 scripts/shell/ports-in-use.sh diff --git a/scripts/shell/format-xml.sh b/scripts/shell/format-xml.sh new file mode 100755 index 0000000..8536c63 --- /dev/null +++ b/scripts/shell/format-xml.sh @@ -0,0 +1,15 @@ +#!/bin/env bash + +# Create a temporary file +temp_file=$(mktemp) + +# Run xmllint and output to the temporary file +if xmllint --format "$1" >"$temp_file"; then + # If successful, replace the original file with the formatted file + mv "$temp_file" "$1" +else + # If unsuccessful, remove the temporary file + rm "$temp_file" + echo "Formatting failed." + exit 1 +fi diff --git a/scripts/shell/ports-in-use.sh b/scripts/shell/ports-in-use.sh new file mode 100755 index 0000000..52360b0 --- /dev/null +++ b/scripts/shell/ports-in-use.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +sudo lsof -i -P -n | grep LISTEN