Write Bash Script Called Move Could Replace Unix Command Mv Move Tries Rename Source File Q37200655

Write a Bash script called move that could replace theUNIX command mv. ‘move’ tries to rename the source file (using theUNIX command mv), but if the destination file exists, appends anindex number, a sort of version number, to the destination file. Soif the user types:

move a.txt b.txt

and b.txt already exists, move will rename the file tob.txt.1. If b.txt.1 already exists, move must rename the file to beb.txt.2, and so on, until the file can be successfully renamed witha name that does not already exist.

This is what I have so far but for some reason instead ofindexing the filenames .1, .2,

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.