MTC logo MTC logo Midlands Technical College
Prospective StudentsEnrolled StudentsFaculty & StaffCommunity Partners
About
Academics
Continuing Education
Distance Learning
Student Forms
Library
Class Schedule
News & Updates
Calendar
Directory
Site Map
Ask MTC
MTC Jobs Bookstore
Home
navigation
 
Search

 

About MTC Academics Continuing Education Distance Learning Student Forms Library Class Schedule News & Updates Calendar Directory Site Map Ask MTC MTC Jobs Bookstore Home


CPT 247


Quick Reference

Exercise

Shellscript1

 

Write a shell script to rename file to new file name.

 Background information.

The rename command dose NOT existing in Linus or Unix.

We create the new command name rename using this script.

We name this script  rename

The key is using an existing Unix command mv (stands for move) to move old file name into new file name.

 

# script file name is    rename.script

echo   " listing your files from current directory "

ls

echo  "    "

echo  "Type in the file name you would like to change from "

read  oldfilename

echo  "Type in file name you would like to change to "

read  newfilename

mv     $oldfilename        $newfilename

echo  " listing of your files after the rename process "

ls