Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++, please. Copy & paste what I gave you into your own file rn (see below), and try it out. Make sure that the

In C++, please.

Copy & paste what I gave you into your own file rn (see below), and try it out. Make sure that the first two characters in the script are #!, with nothing before them. Make it actually rename the file, rather than just saying so. Add a usage message if too many or too few arguments are given. A usage message is a message that tells the user what arguments to give to this script, if an improper number of arguments (including none) are given. Send the usage message to standard error. Complain (to standard error) and stop the script if a file cant be renamed. Not clobber existing files. That is, if we run the script like this: ./rn foo bar and both alpha.foo and alpha.bar exist, the script should complain and refuse to do anything else.

#! /bin/bash

old_suffix=$1 new_suffix=$2

for f in *.$old_suffix do new_name=${f%.*}.$new_suffix echo Rename $f to $new_name done

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions