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...

A(n) ________ is typically the game controller in flight-simulator games

Fill in the blank(s) with correct word

Computer Science & Information Technology

All objects can be ungrouped

Indicate whether the statement is true or false

Computer Science & Information Technology