C
C
cptedward_kenway2021-07-15 11:22:13
linux
cptedward_kenway, 2021-07-15 11:22:13

How to redirect rm to read and delete files from a file?

Good afternoon.

There are ne number of files in the directory, in the same directory there is a file (a), which contains part of the name of these files.
I made bash, which is supposed to read the file and delete on it

#!/bin/bash
cat a.txt | rm -i $a.txt

I did something similar before, but I'm new to linux and when transferring mv files, I accidentally overwrote the directory with the original, correct script...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xibir, 2021-07-15
@cptedward_kenway

xargs rm -i < a.txt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question