Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help. Thank you. The following shell script is used to process files in dir

ID: 3936043 • Letter: N

Question

Need help. Thank you. The following shell script is used to process files in directory test which is located in current working directory. It has following features: Add a prefix "my" to all c files in directory test. E g. Rename test.c as mytest.c Add an extension ".bak" to all txt files in directory test. E g Rename test as test.txt as test.txt.bak compile all java files in directory test Count the number of c files in directory test #1/bin/bash nCfile = 0 for dir in; do case "$dir" in *.c)n n;; *.txt);; esac done echo there are $ncfile c files in directory test

Explanation / Answer

Shell Script to all requirmnets given

for i in *.c ;do mv $i my$i; done //rename all c files in current test folder into with prefix my

for i in *.txt ;do mv $i $i.bak; done   //rename all c files in current test folder into with extension .bak

ls -lR ./*.c | wc -l //counts and dispalys number of c files in current folder

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote