commit c4dec1c5240f9929a5c5782bb79d5e34ce61e70b Author: DedBipki Date: Mon Dec 15 16:48:54 2025 +0000 sdfsd diff --git a/super_tool.sh b/super_tool.sh new file mode 100644 index 0000000..c0dbc78 --- /dev/null +++ b/super_tool.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +while true; do + echo + echo "MENU" + echo "1) Info about current user and OS version" + echo "2) List files" + echo "3) Create file" + echo "4) Ping " + echo "0) Exit" + echo "================" + read -r -p "Make your choice, Mr.Freeman: " choice + + case "$choice" in + 1) + echo + echo "User: $(id -un)" + echo "UID : $(id -u)" + echo "Groups: $(id -Gn)" + echo "OS version:" + if [[ -f /etc/os-release ]]; then + . /etc/os-release + echo "${PRETTY_NAME:-unknown}" + else + uname -sr + fi + ;; + + 2) + echo + echo "Directory: $HOME" + echo "Files:" + ls -la "$HOME" + ;; + + 3) + echo + read -r -p "Enter directory path: " dir + read -r -p "Enter file name: " fname + read -r -p "Enter permissions (like 777 or smth): " perms + + if [[ ! -d "$dir" ]]; then + echo "Error: directory does not exist" + else + path="$dir/$fname" + touch "$path" 2>/dev/null || { echo "Error: cannot create file"; continue; } + + chmod "$perms" "$path" 2>/dev/null || { echo "Error: chmod failed"; continue; } + + echo "Created" + fi + ;; + + 4) + echo + read -r -p "Enter host: " host + ping -c 3 "$host" + ;; + + 0) + exit 0 + ;; + + *) + echo "Wrong option" + ;; + esac +done