File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ A collection of simple Bash scripts.
661 . [ Process.sh] ( scripts/Process.sh ) : execute more than one command in a script
771 . [ Interactive.sh] ( scripts/Interactive.sh ) : a simple but very much interactive script
881 . [ Special_Pattern.sh] ( scripts/Special_Pattern.sh ) : draw a diamond pattern with dots(.)
9+ 1 . [ While-Read.sh] ( scripts/while-read.sh ) : read lines from a file using while loop
9101 . [ Read-Menu.sh] ( scripts/read-menu.sh ) : display a menu for system information
11+ 1 . [ While-Menu.sh] ( scripts/while-menu.sh ) : a repeated menu for system information
10121 . [ Colorfull.sh] ( scripts/Colorfull.sh ) : provide you with the output of several colours
11131 . [ Convertlowercase.sh] ( scripts/convertlowercase.sh ) : convert data either from the file or standard input to lowercase
12141 . [ Encrypt.sh] ( scripts/Encrypt.sh ) : encrypt a file/folder with password
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # while-menu: a menu driven system information program
3+ DELAY=1 # Number of seconds to display results
4+ while [[ $REPLY != 0 ]]; do
5+ clear
6+ cat << _EOF_
7+ Please Select:
8+ 1. Display System Information
9+ 2. Display Disk Space
10+ 3. Display Home Space Utilization
11+ 0. Quit
12+ _EOF_
13+ read -p " Enter selection [0-3] > "
14+ if [[ $REPLY =~ ^[0-3]$ ]]; then
15+ if [[ $REPLY == 1 ]]; then
16+ echo " Hostname: $HOSTNAME "
17+ uptime
18+ sleep $DELAY
19+ fi
20+ if [[ $REPLY == 2 ]]; then
21+ df -h
22+ sleep $DELAY
23+ fi
24+ if [[ $REPLY == 3 ]]; then
25+ if [[ $( id -u) -eq 0 ]]; then
26+ echo " Home Space Utilization (All Users)"
27+ du -sh /home/*
28+ else
29+ echo " Home Space Utilization ($USER )"
30+ du -sh $HOME
31+ fi
32+ sleep $DELAY
33+ fi
34+ else
35+ echo " Invalid entry."
36+ sleep $DELAY
37+ fi
38+ done
39+ echo " Program terminated."
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # while-read: read lines from a file
3+ while read ; do
4+ printf " %s\n" $REPLY
5+ done < /etc/passwd
You can’t perform that action at this time.
0 commit comments