Question
I have a directory called Project1 with 500 files called rock000.py, rock001.py, ... , rock500.py and I want to create a shell script (BASH) that
I have a directory called Project1 with 500 files called rock000.py, rock001.py, ... , rock500.py and I want to create a shell script (BASH) that will rename all these files in this particular directory. The script should take two arguments: a base name and a file extension. Can you please answer the SPECIFIC EXAMPLE below (i.e., add the base name, extension, and file names (old/new) in the code as I am new to Shell (Bash) hence I do not recognize base name and extention etc. well yet): if we run bash project.sh project_rocks py the resulting files in the directory should be like this: project_rocks000.py, project_rocks001.py, .. , project_rocks500.py.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started