Write a shell script that copies the file named by its first argument to a file with the same name with the filename extension of .bak. Thus, if you call the script with the argument first (and a file named first exists in the work- ing directory), after the script runs you would have two files: first and first.bak. Demonstrate that the script works properly.

What will be an ideal response?


$ cat cptobak
#!/bin/bash
#
# This script copies the file named by its first argument
# to the same name with a filename extension of .bak.
#
cp $1 $1.bak
$ ls
cptobak first short
$ ./cptobak first
$ ls
cptobak first first.bak short

Computer Science & Information Technology

You might also like to view...

The ________ data type stores links to websites or files located on your computer

A) Lookup Wizard B) Long Text C) Hyperlink D) Attachment

Computer Science & Information Technology

Bloom's Taxonomy describes how a person progresses through the learning process

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following would be used to refer to the element located in the second row, third column of a two-dimensional array named orders?

A. orders [2] [3] B. orders [1,2] C. orders [2, 3] D. orders [1] [2]

Computer Science & Information Technology

The process giving someone the legal right to practice a profession is called

a. certification. b. licensing. c. matriculation. d. professional ethics. e. professional development.

Computer Science & Information Technology