> 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 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)"
> 
> where the "-i" is for interactive mode (rm will ask you) and the
> quotation marks are such that this is treated as a single argument
> rather than many different ones.
> 
> Note that you might also want to think of passing ls "-1" and and
> possibly sort before taking the tail.
> 
> Best,
> 
> Claudius
> -- 
> Please don’t CC me.
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
> Archive: http://lists.debian.org/20130719211535.19687...@ares.home.chubig.net
> 

Thanks a lot. It worked great.
Regards
Oscar Corte
                                          

Reply via email to