[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shell tr command



On 04/12/2013 10:06, Piviul wrote:

> $ $SHELL --version && echo c0i1a2o3 | tr -d [0-9]
> GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> 
> This is free software; you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> c0ia2o3

Prova a proteggere [0-9] con degli apici.

[0-9] potrebbe essere interpretato dalla shell ed essere sostituito con
il nome di un file se ce ne è uno nella directory corrente (in quel caso
il nome del file deve essere solo un numero da 0 a 9):

$ echo [0-9]
[0-9]
$ touch 5
$ echo [0-9]
5
$ echo '[0-9]'
[0-9]

-- 
Kind regards,
                                                          Marco Romano.


Reply to: