Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell script to change extension of an existing file

Posted By: Connor Evans     Category: Unix / Linux / Ubuntu     Views: 8339

Write a shell script to change extension of an existing file.

Code for Shell script to change extension of an existing file in Unix / Linux / Ubuntu

clear
echo "Enter first file name: "
read f1
if [ -f $f1 ]
then
    echo "Enter new extention: " 
    read e

    cp ${f1} ${f1}.$e

#    i=basename $f1
#    b= $i txt

#    for file in *.txt
#    i=`basename file txt`
#    mv $file $i doc

    echo $f1"."$e" file is created"else
    echo "File not Exist "
fi
  
Share: 


Didn't find what you were looking for? Find more on Shell script to change extension of an existing file Or get search suggestion and latest updates.

Connor Evans
Connor Evans author of Shell script to change extension of an existing file is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!