Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Color scheme
- RED='\033[0;31m'
- NC='\033[0m'
- GREEN='\033[1;32m'
- BLUE='\033[0;34m'
- CYAN='\033[0;36m'
- LBLUE='\033[1;34m'
- LLBLUE='\033[1:225m'
- ORANGE=$(tput setaf 172)
- YELLOW=$(tput setaf 11)
- function msg_box() {
- local term_width=50
- local str=("$@") msg_width
- printf '\n'
- for line in "${str[@]}"; do
- ((msg_width<${#line})) && { msg_width="${#line}"; }
- if [ $msg_width -gt $term_width ]; then
- error_quit "\$msg_width exceeds \$term_width.\n"
- fi
- x=$(($term_width - $msg_width))
- pad=$(($x / 2))
- done
- printf '%s┌' "${ORANGE}" && printf '%.0s─' {0..49} && printf '┐\n' && printf '│%49s │\n'
- for line in "${str[@]}"; do
- rpad=$((50 - $pad - $msg_width))
- printf "│%$pad.${pad}s" && printf '%s%*s' "$YELLOW" "-$msg_width" "$line" "${ORANGE}" && printf "%$rpad.${rpad}s│\n"
- done
- printf '│%49s │\n' && printf '└' && printf '%.0s─' {0..49} && printf '┘\n%s' ${RESET}
- }
- function menu() {
- msg_box "1.System Info 2.Disk List" "3.Disk Name 4.Proc Info" "5.Raid Info 6.MB Info" "7.Bios Info 8.Memory Info" "9.Net Info 10.Graph Info" "11.Sound Info 12.Disk Ident" "0.Exit"
- }
- function input {
- printf "${LBLUE}$ Provide one option (number): ${NC}"
- read -r d
- echo -e "\n"
- }
- function selectors {
- case "$d" in
- "0") clear && exit ;;
- "1") echo "Hostname: $HOSTNAME"; uptime ;;
- "2") df -h ;;
- "3") printf "${YELLOW}Enter SCSI Hard Disks (e.g /dev/sda): ${NC}"
- read -r a
- echo -e "\n"
- sudo hdparm -i $a | grep -i model ;;
- "4") cat /proc/cpuinfo ;;
- "5") lspci | grep -i raid ;;
- "6") sudo dmidecode -t baseboard ;;
- "7") sudo dmidecode -t bios ;;
- "8") sudo dmidecode -t memory ;;
- "9") sudo lspci | grep -i eth ;;
- "10") sudo lspci | grep -i vga ;;
- "11") lspci | grep -i audio ;;
- "12") c=`cat /sys/block/sda/queue/rotational`
- if [[ $c == 1 ]]; then
- printf "${YELLOW}Your disk is HDD"
- else
- printf "${YELLOW}Your disk is SSD"
- fi ;;
- *) printf "${RED}No option (number) provided${NC}" ;
- esac
- }
- function print_prompt() {
- declare wantreturn=${3} str end default
- if [ -n "$wantreturn" ]; then
- str="$(printf "${CYAN}To return to press [Enter]${NC}")"
- else
- str="$(printf "${CYAN}To return to Press any key${NC}")"
- fi
- end="${2:-$str}"
- [ -z "$end" ] && end="$str"
- default="${1} ${str}"
- printf "$default"
- if [ -n "$wantreturn" ]; then
- read
- else
- read -n1 -s
- fi
- }
- while true; do
- clear
- menu
- input
- selectors
- echo -e "\n"
- print_prompt
- clear
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement