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 the syntax of "expr" command?

2 Answers  


How to get the last line from a file using just the terminal?

0 Answers  


What is shell geeksforgeeks?

0 Answers  


one folder contains lot of students name but I want to fetch hello with every student name individually using shell script

0 Answers  


how to read systems current date and time

4 Answers  






write a program to display all the files from the current directory which are created in particular month

6 Answers  


Explain about "s" permission bit in a file?

0 Answers  


What is sudo command?

0 Answers  


How to write a function?

0 Answers  


Calculate a real number calculation directly from the terminal and not any shell script.

0 Answers  


What is computer cli?

0 Answers  


How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?

0 Answers  


Categories