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

How do I run a shell script on a mac?

0 Answers  


‎What is a shell? · ‎Types of shell · ‎what is shell scripting?

0 Answers  


what are command line arguments? what is the need of those?

1 Answers   Flipkart,


What is shell terminal?

0 Answers  


What are the 3 standard streams in linux?

0 Answers  






what is the difference between sh & bash shell?

1 Answers  


Why we are writting shell scripts? Plz if possible explain it briefly.

6 Answers   ITC Infotech,


What are scripts in psychology?

0 Answers  


what is info area how many types?

0 Answers  


I want to read all input to the command from file1 direct all output to file2 and error to file 3, how can I achieve this?

1 Answers  


What is awk in shell script?

0 Answers  


What is shell geeksforgeeks?

0 Answers  


Categories