Re: Strings manipulation without using variables

2010-04-01 Thread Francesco Pretto
Greg Wooledge eeg.ccf.org> writes: > Just in case, it needs to be pointed out that using ls in this way is > NOT a safe operation, since filenames may contain newlines (or other > characters that ls may choose to represent with a ? instead of leaving > intact, depending on the implementation). Ne

Re: Strings manipulation without using variables

2010-04-01 Thread Francesco Pretto
Bob Proulx proulx.com> writes: > I assume that 'ls' isn't what you actually are doing, that you have > reduced the test case to something smaller (thank you for that!) > because the shell can list the directory itself. > Yup, doing 'ls' wasn't what I needed: it was just the first nonsense/nontriv

Re: Strings manipulation without using variables

2010-03-31 Thread Greg Wooledge
On Wed, Mar 31, 2010 at 11:03:17AM -0600, Bob Proulx wrote: > Or with GNU sed using the \+ extension: > > FILENAME=$(ls | tail --lines=1 | sed 's/\.[^.]\+$//') > > I assume that 'ls' isn't what you actually are doing, that you have > reduced the test case to something smaller (thank you for tha

Re: Strings manipulation without using variables

2010-03-31 Thread Bob Proulx
Francesco Pretto wrote: > I'm sorry if this isn't the wrong place to ask, but I couldn't find an user > mailing list. The help-gnu-ut...@gnu.org mailing list is available for generic help questions such as this. > My question is if it's possible to manipulate strings without > using variables. O

Strings manipulation without using variables

2010-03-31 Thread Francesco Pretto
Hello, I'm sorry if this isn't the wrong place to ask, but I couldn't find an user mailing list. My question is if it's possible to manipulate strings without using variables. Or, how to do the following in one line without using a variable: FILENAME=$(ls | tail --lines=1) echo ${FILENAME%.*} I