how to use the output of a file for input of a command
I have copied the contens of a bin directory to my /usr/bin directory.
and now I want to remove all the files that i copied in there.
but i don't want to type all of the files after the rm command. so I figured: why dont I just take the input of the list command from the first bin directory and use it on the remove command in the other.
so why wont this work?
ls > remfiles
cp remfiles /usr/bin
rm < remfiles
(as root off course)
ls > remfiles only copies the output of the "ls" command to the file "remfiles" not the actual files/programs.. The "<" is used for redirection of output/input. I am not sure how many files you are trying to move and delete. If it is a relatively small amount you can type a partial file name and press the TAB key and the shell will automatically complete the rest of the file name. If all the files are of the same type , for example .wav files, you can type
and all files of that type will be removed. Likewise if you want to copy all files of a type you can use the command
cp *.wav /usr/bin
and all .wav files will be copied to /usr/bin. I hope this is of some help.
'rm -f' will not ask you if you really want to delete files
|All times are GMT -5. The time now is 09:02 PM.|