Logo 
Search:

Unix / Linux / Ubuntu Articles

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

Write a shell script for renaming each files in the directory such that it will have the current shell PID as an extension

Posted By: Keana Schmidt     Category: Unix / Linux / Ubuntu     Views: 5016

Write a shell script for renaming each files in the directory such that it will have the current shell PID as an extension. the shell script should ensure that the directories do not get renamed.

Code for Write a shell script for renaming each files in the directory such that it will have the current shell PID as an extension in Unix / Linux / Ubuntu

for name in `ls *.txt`
do
    i=`basename $name txt`
    mv $name ${i}sh
done 

  
Share: 



Keana Schmidt
Keana Schmidt author of Write a shell script for renaming each files in the directory such that it will have the current shell PID as an extension is from Frankfurt, Germany.
 
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!