Re: Bash function not working…

Johnny Rosenberg gurus.knugum at gmail.com
Tue Jan 8 16:57:00 UTC 2013


2013/1/8 Paul Smith <paul at mad-scientist.net>:
> On Tue, 2013-01-08 at 11:35 -0500, Tom H wrote:
>> On Tue, Jan 8, 2013 at 11:04 AM, JD <jd1008 at gmail.com> wrote:
>> > On 01/08/2013 08:38 AM, Johnny Rosenberg wrote:
>> >>
>> >> I defined the following function in .bash-functions (which is called
>> >> from .bashrc):
>> >>
>> >> speltid () {
>> >> ffmpeg -i $1 2>&1 | \
>> >> grep Duration | \
>> >> awk -F , '{print $1}' | \
>> >> sed 's/^.*Duration/Speltid/' | \
>> >> sed 's/\./,/'
>> >> }
>> >
>> > For starters, you have a coma after -F
>> > bad syntax.
>> > But I tried it without that coma (interactively)
>> > and it kills the shell.
>>
>> Either
>> -F ","
>> or
>> -F,
>
> Still no.  See my previous email.
>
> If these changes are actually making any difference whatever on your
> systems you must be using a seriously bizarre (and non-standard) shell.
>
>         $ echo "hi there, you" | awk '{print $1}'
>         hi
>
>         $ echo "hi there, you" | awk -F , '{print $1}'
>         hi there
>
>         $ echo "hi there, you" | awk -F, '{print $1}'
>         hi there
>
>         $ echo "hi there, you" | awk -F "," '{print $1}'
>         hi there

Thanks for all replies. As many pointed out, replacing , with ","
didn't change anything. I will do some more tests to see if I can
figure out which pipe mess things up.
In the mean time, more replies are welcome, of course…

Johnny Rosenberg




More information about the ubuntu-users mailing list