I need some help with writing a Bash script. I have tried a lot but can't figure out how to finish it and I am new to programming.
I want to create a script that will take a parameter that should be a sub-directory of the current directory.
And then find if the parameter is a file or directory.
If it is a directory it should just add the extension text at the end of the name of the found directory DDD.
And if it is a file that has the following extension 'mpg or wmv or mov', it should add at the end of the same extension as the file extension at the end of the file name.
Example:
If the file name is: hello.mov
, it will be renamed as hello.mov.mov
My Script:
#!/bin/bash
for file in ./$*
do
find ./$1 -maxdepth 1
if [ -d $file ]
?????????
fi
for ext in avi mpg wmv mov;
do
?????????????????