Create a bash shell script that removes all files whose
names end with a "~" from your home directory and
subdirectories. Name this script "cleanup.sh"

Answers were Sorted based on User's Feedback



Create a bash shell script that removes all files whose names end with a "~" from your h..

Answer / cdude

#/bin/bash

rm `find . -name *~`

Is This Answer Correct ?    14 Yes 3 No

Create a bash shell script that removes all files whose names end with a "~" from your h..

Answer / alok

find . -name *~ -exec rm -i {} \;

It will ask you before deletion of this file

Is This Answer Correct ?    6 Yes 2 No

Create a bash shell script that removes all files whose names end with a "~" from your h..

Answer / sasmita

rm ' find /home -name "$~" -print' cleanup.sh

Is This Answer Correct ?    4 Yes 0 No

Create a bash shell script that removes all files whose names end with a "~" from your h..

Answer / somnath

#!/bin/bash

find /home -name "*~" | xargs rm

Is This Answer Correct ?    1 Yes 1 No

Create a bash shell script that removes all files whose names end with a "~" from your h..

Answer / stevemc

#!/bin/bash

cd ~

find . -name "*~" | xargs rm

Is This Answer Correct ?    1 Yes 2 No

Create a bash shell script that removes all files whose names end with a "~" from your h..

Answer / kuldeep singh

#!/bin/sh

cd | ls -lR | grep "~$" | rm -f

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More Shell Script Interview Questions

What is shell and shell script?

0 Answers  


What is echo in shell?

0 Answers  


how to search for vowels a,e,i,o,u appearing in the same sequence in a file

4 Answers   Amazon,


What is shell environment?

0 Answers  


What are scripts in psychology?

0 Answers  






Write a shell script to check whether a number is Armstrong number or not?

1 Answers   Flipkart,


There is a record with fields namely name,roll no.,salary,grade etc.Now,write a script to create a file with multiple records have same combination of fields but with unique roll numbers.The script should work for different names in the input file.

1 Answers   Wipro,


What is the basic difference you find between a shell script and perl?

3 Answers   Yahoo,


Explain about non-login shell files?

0 Answers  


What are the advantages of shell scripting?

0 Answers  


Is powershell a bash?

0 Answers  


How can I set the default rwx permission to all users on every file which is created in the current shell?

0 Answers  


Categories