Re: Remove file resulting from ls|tail -1

2013-09-20 Thread Andrei POPESCU
On Vi, 19 iul 13, 21:15:35, Claudius Hubig wrote: > Dear Oscar, > > what a surprising name… > > OECT T wrote: > > I need to delete the file resulting from: ls | tail -1 How do you know the last file in the output of 'ls' is the one you need? I'd rather use find with -delete for something like

Re: Remove file resulting from ls|tail -1

2013-07-22 Thread Teemu Likonen
Claudius Hubig [2013-07-19 21:15:35 +02:00] wrote: > $ rm -i "$(ls | tail -1)" When the file list is unknown (i.e., comes from a variable or pipe etc.) it is often a good idea to separete options and filenames with the pseudo-option "--": $ rm -i -- "$(ls | tail -1)" This way filenames whic

RE: Remove file resulting from ls|tail -1 (SOLVED)

2013-07-19 Thread OECT T
> Date: Fri, 19 Jul 2013 21:15:35 +0200 > From: debian_1...@chubig.net > To: debian-user@lists.debian.org > Subject: Re: Remove file resulting from ls|tail -1 > > Dear Oscar, > > what a surprising name… Thanks > > OECT T wrote: > > I need to delete th

Remove file resulting from ls|tail -1

2013-07-19 Thread OECT T
Hola: I need to delete the file resulting from: ls | tail -1 I've tried some commands resulting from Google searches without success. OS is Debian squeeze 6.0.7 I'll appreciate any hints Regards Oscar Corte

Re: Remove file resulting from ls|tail -1

2013-07-19 Thread Claudius Hubig
Dear Oscar, what a surprising name… OECT T wrote: > I need to delete the file resulting from: ls | tail -1 In Bash, $(command) is replaced with the output of "command". For example, $ touch $(seq 1 4) will create files 1, 2, 3 and 4. So you likely want something like $ rm -i "$(ls | tail -1)