CIT 112 Hands-on Application Activity Week 101.Chapter 27 Flow Control: Branching with if1.1Create a BASH script called script1.sh which takes in the name of a month (e.g. Jan, Feb, Mar, ...)...

1 answer below »
I need to use nano


CIT 112 Hands-on Application Activity Week 10 1.Chapter 27 Flow Control: Branching with if 1.1Create a BASH script called script1.sh which takes in the name of a month (e.g. Jan, Feb, Mar, ...) and a day (e.g. 1, 2, 3, ...) as command arguments. Display whether the month is an odd (e.g. Jan, Mar, ...) or even (e.g. Feb, Apr, ...) month as well as whether the day is an odd or even day. Your input and output should look similar to the one below: okuda@okuda:~/Day10$ . ./script1.sh Jan 1 Jan is an odd month 1 is an odd day okuda@okuda:~/Day10$ . ./script1.sh Feb 2 Feb is an even month 2 is an even day okuda@okuda:~/Day10$ . ./script1.sh May 4 May is an odd month 4 is an even day 1.2Run the script and paste the output 1.3Paste the content of the script 2.Chapter 28 Reading Keyboard Input 2.1Create a BASH script called script2.sh which takes in a directory name and a file name as command arguments. The script consists of two logical parts. Part 1) If the specified directory does NOT exist, prompt the user if the directory should be created. If "No", end the script. If "Yes", create the specified directory. Part 2) If the specified directory already exists, verify that the specified file exists in the specified directory. If the file does not exist, prompt the user if the file should be created under the specified directory. If "No", print the long listing of the files in the specified directory and end the script. If "Yes", create the file under the specified directory, print the long listing of the files in the specified directory, and end the script. Your script output should look similar to the one below: okuda@okuda:~/Day10$ . ./script2.sh DirA fileA DirA directory does not exist. Do you want to create it (Y/N)?n okuda@okuda:~/Day10$ . ./script2.sh DirA fileA DirA directory does not exist. Do you want to create it (Y/N)?y Creating DirA directory. fileA file does not exist in DirA directory. Do you want to create it (Y/N)?n Here is the list of files in DirA directory: total 0 okuda@okuda:~/Day10$ . ./script2.sh DirA fileA DirA directory exists. fileA file does not exist in DirA directory. Do you want to create it (Y/N)?y Creating fileA file in DirA directory. Here is the list of files in DirA directory: total 0 -rw-rw-r-- 1 okuda okuda 0 Apr 28 15:06 fileA okuda@okuda:~/Day10$ . ./script2.sh DirA fileB DirA directory exists. fileB file does not exist in DirA directory. Do you want to create it (Y/N)?y Creating fileB file in DirA directory. Here is the list of files in DirA directory: total 0 -rw-rw-r-- 1 okuda okuda 0 Apr 28 15:06 fileA -rw-rw-r-- 1 okuda okuda 0 Apr 28 15:06 fileB okuda@okuda:~/Day10$ 2.2Run the script and paste the output 2.3Paste the content of the script 3.Chapter 29 Flow Control: Looping with while/until 3.1Create a BASH script called script3.sh which takes in a file name as a command argument. The script consists of 6 logical parts. Part 1) Print the menu options as shown below and wait for the user response. 1. Display the Memory usage 2. Display the Disk usage 3. Print the content of the specified file 4. Exit Part 2) If option 1 is selected, execute "free -h" command. Part 3) If option 2 is selected, execute "df -h" command. Part 4) If option 3 is selected, print the content of the file as specified in the command argument. Use "while read ...< filename" command, instead of "cat" command. part 5) if option 4 is selected, end the script. part 6) the whole script should be in a while true loop. your script output should look similar to the one below: okuda@okuda:~/day10$ . ./script3.sh ~/.vimrc 1. display the disk usage 2. display the memory usage 3. print the content of /home/okuda/.vimrc file 4. exit choose your option [1-4]:1 total used free shared buff/cache available mem: 3.8gi 630mi 1.8gi 8.0mi 1.4gi 3.0gi swap: 1.1gi 0b 1.1gi 1. display the disk usage 2. display the memory usage 3. print the content of /home/okuda/.vimrc file 4. exit choose your option [1-4]:2 filesystem size used avail use% mounted on udev 1.9g 0 1.9g 0% /dev tmpfs 394m 1.4m 393m 1% /run /dev/sda5 24g 6.5g 17g 29% / tmpfs 2.0g 0 2.0g 0% /dev/shm tmpfs 5.0m 4.0k 5.0m 1% /run/lock tmpfs 2.0g 0 2.0g 0% /sys/fs/cgroup /dev/loop0 55m 55m 0 100% /snap/core18/1880 /dev/loop2 219m 219m 0 100% /snap/gnome-3-34-1804/66 /dev/loop3 52m 52m 0 100% /snap/snap-store/518 /dev/loop1 66m 66m 0 100% /snap/gtk-common-themes/1515 /dev/loop4 65m 65m 0 100% /snap/gtk-common-themes/1514 /dev/loop5 56m 56m 0 100% /snap/core18/1997 /dev/loop6 256m 256m 0 100% /snap/gnome-3-34-1804/36 /dev/loop7 33m 33m 0 100% /snap/snapd/11588 /dev/loop8 50m 50m 0 100% /snap/snap-store/467 /dev/loop9 30m 30m 0 100% /snap/snapd/8542 /dev/sda1 511m 4.0k 511m 1% /boot/efi tmpfs 394m 20k 394m 1% /run/user/1000 /dev/sr0 59m 59m 0 100% /media/okuda/vbox_gas_6.1.18 1. display the disk usage 2. display the memory usage 3. print the content of /home/okuda/.vimrc file 4. exit choose your option [1-4]:3 syntax on set tabstop=4 set softtabstop=4 set expandtab set incsearch 1. display the disk usage 2. display the memory usage 3. print the content of /home/okuda/.vimrc file 4. exit choose your option [1-4]:4 bye! okuda@okuda:~/day10$ 3.2run the script and paste the output 3.3paste the content of the script filename"="" command,="" instead="" of="" "cat"="" command.="" part="" 5)="" if="" option="" 4="" is="" selected,="" end="" the="" script.="" part="" 6)="" the="" whole="" script="" should="" be="" in="" a="" while="" true="" loop.="" your="" script="" output="" should="" look="" similar="" to="" the="" one="" below:="" okuda@okuda:~/day10$="" .="" ./script3.sh="" ~/.vimrc="" 1.="" display="" the="" disk="" usage="" 2.="" display="" the="" memory="" usage="" 3.="" print="" the="" content="" of="" home/okuda/.vimrc="" file="" 4.="" exit="" choose="" your="" option="" [1-4]:1="" total="" used="" free="" shared="" buff/cache="" available="" mem:="" 3.8gi="" 630mi="" 1.8gi="" 8.0mi="" 1.4gi="" 3.0gi="" swap:="" 1.1gi="" 0b="" 1.1gi="" 1.="" display="" the="" disk="" usage="" 2.="" display="" the="" memory="" usage="" 3.="" print="" the="" content="" of="" home/okuda/.vimrc="" file="" 4.="" exit="" choose="" your="" option="" [1-4]:2="" filesystem="" size="" used="" avail="" use%="" mounted="" on="" udev="" 1.9g="" 0="" 1.9g="" 0%="" dev="" tmpfs="" 394m="" 1.4m="" 393m="" 1%="" run="" dev/sda5="" 24g="" 6.5g="" 17g="" 29%="" tmpfs="" 2.0g="" 0="" 2.0g="" 0%="" dev/shm="" tmpfs="" 5.0m="" 4.0k="" 5.0m="" 1%="" run/lock="" tmpfs="" 2.0g="" 0="" 2.0g="" 0%="" sys/fs/cgroup="" dev/loop0="" 55m="" 55m="" 0="" 100%="" snap/core18/1880="" dev/loop2="" 219m="" 219m="" 0="" 100%="" snap/gnome-3-34-1804/66="" dev/loop3="" 52m="" 52m="" 0="" 100%="" snap/snap-store/518="" dev/loop1="" 66m="" 66m="" 0="" 100%="" snap/gtk-common-themes/1515="" dev/loop4="" 65m="" 65m="" 0="" 100%="" snap/gtk-common-themes/1514="" dev/loop5="" 56m="" 56m="" 0="" 100%="" snap/core18/1997="" dev/loop6="" 256m="" 256m="" 0="" 100%="" snap/gnome-3-34-1804/36="" dev/loop7="" 33m="" 33m="" 0="" 100%="" snap/snapd/11588="" dev/loop8="" 50m="" 50m="" 0="" 100%="" snap/snap-store/467="" dev/loop9="" 30m="" 30m="" 0="" 100%="" snap/snapd/8542="" dev/sda1="" 511m="" 4.0k="" 511m="" 1%="" boot/efi="" tmpfs="" 394m="" 20k="" 394m="" 1%="" run/user/1000="" dev/sr0="" 59m="" 59m="" 0="" 100%="" media/okuda/vbox_gas_6.1.18="" 1.="" display="" the="" disk="" usage="" 2.="" display="" the="" memory="" usage="" 3.="" print="" the="" content="" of="" home/okuda/.vimrc="" file="" 4.="" exit="" choose="" your="" option="" [1-4]:3="" syntax="" on="" set="" tabstop="4" set="" softtabstop="4" set="" expandtab="" set="" incsearch="" 1.="" display="" the="" disk="" usage="" 2.="" display="" the="" memory="" usage="" 3.="" print="" the="" content="" of="" home/okuda/.vimrc="" file="" 4.="" exit="" choose="" your="" option="" [1-4]:4="" bye!="" okuda@okuda:~/day10$="" 3.2="" run="" the="" script="" and="" paste="" the="" output="" 3.3="" paste="" the="" content="" of="" the="">
Answered 1 days AfterMar 11, 2023

Answer To: CIT 112 Hands-on Application Activity Week 101.Chapter 27 Flow Control: Branching with...

Sumit Kumar answered on Mar 12 2023
31 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here