Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #30168 > unrolled thread
| Started by | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| First post | 2020-06-22 09:42 +0100 |
| Last post | 2020-06-23 13:32 +0200 |
| Articles | 20 on this page of 33 — 13 participants |
Back to article view | Back to comp.os.linux.misc
I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-22 09:42 +0100
Re: I hate shell Jack Strangio <jackstrangio@yahoo.com> - 2020-06-22 14:01 +0000
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-22 17:05 +0100
Re: I hate shell Grant Taylor <gtaylor@tnetconsulting.net> - 2020-06-22 10:23 -0600
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-22 18:48 +0100
Re: I hate shell Robert Heller <heller@deepsoft.com> - 2020-06-22 11:32 -0500
Re: I hate shell Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2020-06-22 12:41 -0400
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-22 18:49 +0100
Re: I hate shell Jack Strangio <jackstrangio@yahoo.com> - 2020-06-22 21:50 +0000
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-23 05:04 +0100
Re: I hate shell Aragorn <thorongil@telenet.be> - 2020-06-23 10:15 +0200
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-23 09:38 +0100
Re: I hate shell Aragorn <thorongil@telenet.be> - 2020-06-23 13:31 +0200
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-23 14:09 +0100
Re: I hate shell Aragorn <thorongil@telenet.be> - 2020-06-23 15:58 +0200
Re: I hate shell Harold Stevens <wookie@fossa.localdomain> - 2020-06-23 09:16 -0500
Re: I hate shell Joe Beanfish <joebeanfish@nospam.duh> - 2020-06-23 14:17 +0000
Re: I hate shell Aragorn <thorongil@telenet.be> - 2020-06-23 16:58 +0200
Re: I hate shell Rich <rich@example.invalid> - 2020-06-23 16:47 +0000
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-23 19:13 +0100
Re: I hate shell Joe Beanfish <joebeanfish@nospam.duh> - 2020-06-24 20:54 +0000
Re: I hate shell gazelle@shell.xmission.com (Kenny McCormack) - 2020-06-24 23:24 +0000
Re: I hate shell Jack Strangio <jackstrangio@yahoo.com> - 2020-06-22 23:11 +0000
Re: I hate shell Rich <rich@example.invalid> - 2020-06-23 01:33 +0000
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-23 05:07 +0100
Re: I hate shell Jack Strangio <jackstrangio@yahoo.com> - 2020-06-24 03:59 +0000
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-23 05:05 +0100
Re: I hate shell Eli the Bearded <*@eli.users.panix.com> - 2020-06-23 18:41 +0000
Re: I hate shell "Anonymous Remailer (austria)" <mixmaster@remailer.privacy.at> - 2020-06-23 11:12 +0200
Re: I hate shell Rathbone <please@replytolist.com> - 2020-06-22 20:22 +0000
Re: I hate shell Aragorn <thorongil@telenet.be> - 2020-06-23 10:20 +0200
Re: I hate shell The Natural Philosopher <tnp@invalid.invalid> - 2020-06-23 09:41 +0100
Re: I hate shell Aragorn <thorongil@telenet.be> - 2020-06-23 13:32 +0200
Page 1 of 2 [1] 2 Next page →
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2020-06-22 09:42 +0100 |
| Subject | I hate shell |
| Message-ID | <rcpqt0$g9i$1@dont-email.me> |
It simply doesn't behave as the manual says it does. 6 hours and counting for a 4 line script...sigh. quicker to write in 'C' -- All political activity makes complete sense once the proposition that all government is basically a self-legalising protection racket, is fully understood.
[toc] | [next] | [standalone]
| From | Jack Strangio <jackstrangio@yahoo.com> |
|---|---|
| Date | 2020-06-22 14:01 +0000 |
| Message-ID | <qCBywp.rJ1z@yahoo.com> |
| In reply to | #30168 |
The Natural Philosopher <tnp@invalid.invalid> writes:
> It simply doesn't behave as the manual says it does.
> 6 hours and counting for a 4 line script...sigh. quicker to write in 'C'
>
Which shell are you writing the script in?
Are you using a valid 'hash-bang' line to specify the executing
shell or program? as in
#!/bin/bash
as the first line.
Otherwise it will very likely revert to the 'sh' shell which uses
different syntax to 'bash' or 'csh' or 'zsh'.
Are you using the correct manual?
What are you trying to do?
Do you have any script at all?
What errors do you receive?
Is this a serious question or are you a troll?
Jack
--
"It's rather cold." she said bitchily.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2020-06-22 17:05 +0100 |
| Message-ID | <rcqkss$f17$1@dont-email.me> |
| In reply to | #30171 |
On 22/06/2020 15:01, Jack Strangio wrote:
> The Natural Philosopher <tnp@invalid.invalid> writes:
>> It simply doesn't behave as the manual says it does.
>> 6 hours and counting for a 4 line script...sigh. quicker to write in 'C'
>>
>
> Which shell are you writing the script in?
>
> Are you using a valid 'hash-bang' line to specify the executing
> shell or program? as in
>
> #!/bin/bash
>
> as the first line.
Of course.
>
> Otherwise it will very likely revert to the 'sh' shell which uses
> different syntax to 'bash' or 'csh' or 'zsh'.
>
> Are you using the correct manual?
>
What manual?
> What are you trying to do?
>
recursively look for non H264 encoded files and ffmpeg them into web shape.
> Do you have any script at all?
yeah. Ive got it working well enough now for te one ogf use IO need it for.
>
> What errors do you receive?
So many I lost count, and did things a different way.
Mostly the utterly inconsistent treatment of white space or the lack of it.
I wrote a small bit in C - its strips the extension from a file path if
it has one.
I couldn't believe that there wasn't a unix utility to do this..
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// strip extension from file path
main(int argc, char **argv)
{
char *path;
int len;
if (argc==1)
exit(0);
path=argv[1];
len=strlen(path);
do
{
if(path[len]=='/') // we havent found a period so no extension
break;
if (path[len]=='.') // we have
{
path[len]=0;
break;
}
}
while (--len);
printf("%s",path);
}
>
> Is this a serious question or are you a troll?
>
Yes. No. I was venting my frustration. Bourne was a twat. So was the guy
that wrote PERL. And the one that invented regex
Compared with their divinesseses, Kernighan and Ritchie.
> Jack
>
--
All political activity makes complete sense once the proposition that
all government is basically a self-legalising protection racket, is
fully understood.
[toc] | [prev] | [next] | [standalone]
| From | Grant Taylor <gtaylor@tnetconsulting.net> |
|---|---|
| Date | 2020-06-22 10:23 -0600 |
| Message-ID | <rcqltc$7a1$1@tncsrv09.home.tnetconsulting.net> |
| In reply to | #30172 |
On 6/22/20 10:05 AM, The Natural Philosopher wrote:
> What manual?
The manual for the shell that you're trying to use.
> recursively look for non H264 encoded files and ffmpeg them into web shape.
Hum. That's a tall order. How is ffmpeg going to encode an ISO image
or a block device into "web shape" what ever that means.
I suspect that you are eliding important criteria.
> Mostly the utterly inconsistent treatment of white space or the lack of it.
White spaces in file and / or directory names is a big problem. The
shell method of dealing with this is to properly quote the file names.
This becomes annoying ~> difficult as you pass such file names as
options to things like functions and recursive scripts. Great care must
be taken.
Another hack is to encode the space(s) when passing parameters around
and then decode them when finally needed.
> I wrote a small bit in C - its strips the extension from a file path if
> it has one.
The "head", "tail", "root", and "extension" history modifiers
immediately come to mind. But they may not work in the context that you
want them to.
So, variable expansion substitution comes to mind. ${myVar%.*} or
${myVar%%.*} Again, somewhat context sensitive.
> I couldn't believe that there wasn't a unix utility to do this..
Depending on what "this" /specifically/ is, I'm quite sure there's a way
to do it.
I would expect that you are wanting something like find or a recursive
loop that identifies candidate files, passes said candidate files to a
script / function which tests to see if the file is viable for
conversion and subsequently converts viable files.
Removing and / or substituting a file extension is largely an old hat
trick. It just spends what old hat you're using.
> Yes. No. I was venting my frustration. Bourne was a twat. So was the guy
> that wrote PERL. And the one that invented regex
>
> Compared with their divinesseses, Kernighan and Ritchie.
You are as free to your opinion as I am to mind.
--
Grant. . . .
unix || die
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2020-06-22 18:48 +0100 |
| Message-ID | <rcqqsi$t6t$1@dont-email.me> |
| In reply to | #30173 |
On 22/06/2020 17:23, Grant Taylor wrote:
> On 6/22/20 10:05 AM, The Natural Philosopher wrote:
>> What manual?
>
> The manual for the shell that you're trying to use.
>
>> recursively look for non H264 encoded files and ffmpeg them into web
>> shape.
>
H264/AAC is 'web shape' - all HTML5 browsers handle these
> Hum. That's a tall order. How is ffmpeg going to encode an ISO image
> or a block device into "web shape" what ever that means.
>
> I suspect that you are eliding important criteria.
>
Nope. the task is simpler. Identify using ffprobe and some shell magic
in conjunction with find, all files than dont have H264 encoding, and
run then through ffmpeg to re-samplle them into AAC/H264 encoding.
>> Mostly the utterly inconsistent treatment of white space or the lack
>> of it.
>
> White spaces in file and / or directory names is a big problem. The
> shell method of dealing with this is to properly quote the file names.
> This becomes annoying ~> difficult as you pass such file names as
> options to things like functions and recursive scripts. Great care must
> be taken.
>
> Another hack is to encode the space(s) when passing parameters around
> and then decode them when finally needed.
>
>> I wrote a small bit in C - its strips the extension from a file path
>> if it has one.
>
> The "head", "tail", "root", and "extension" history modifiers
> immediately come to mind. But they may not work in the context that you
> want them to.
>
> So, variable expansion substitution comes to mind. ${myVar%.*} or
> ${myVar%%.*} Again, somewhat context sensitive.
>
>> I couldn't believe that there wasn't a unix utility to do this..
>
> Depending on what "this" /specifically/ is, I'm quite sure there's a way
> to do it.
>
look at tey code and see what it does
> I would expect that you are wanting something like find or a recursive
> loop that identifies candidate files, passes said candidate files to a
> script / function which tests to see if the file is viable for
> conversion and subsequently converts viable files.
>
> Removing and / or substituting a file extension is largely an old hat
> trick. It just spends what old hat you're using.
>
>> Yes. No. I was venting my frustration. Bourne was a twat. So was the
>> guy that wrote PERL. And the one that invented regex
>>
>> Compared with their divinesseses, Kernighan and Ritchie.
>
> You are as free to your opinion as I am to mind.
>
>
>
--
"In our post-modern world, climate science is not powerful because it is
true: it is true because it is powerful."
Lucas Bergkamp
[toc] | [prev] | [next] | [standalone]
| From | Robert Heller <heller@deepsoft.com> |
|---|---|
| Date | 2020-06-22 11:32 -0500 |
| Message-ID | <TOCdnSDaJLq3QG3DnZ2dnUU7-V_NnZ2d@giganews.com> |
| In reply to | #30172 |
At Mon, 22 Jun 2020 17:05:48 +0100 The Natural Philosopher <tnp@invalid.invalid> wrote:
>
> On 22/06/2020 15:01, Jack Strangio wrote:
> > The Natural Philosopher <tnp@invalid.invalid> writes:
> >> It simply doesn't behave as the manual says it does.
> >> 6 hours and counting for a 4 line script...sigh. quicker to write in 'C'
> >>
> >
> > Which shell are you writing the script in?
> >
> > Are you using a valid 'hash-bang' line to specify the executing
> > shell or program? as in
> >
> > #!/bin/bash
> >
> > as the first line.
> Of course.
>
> >
> > Otherwise it will very likely revert to the 'sh' shell which uses
> > different syntax to 'bash' or 'csh' or 'zsh'.
> >
> > Are you using the correct manual?
> >
> What manual?
>
> > What are you trying to do?
> >
>
> recursively look for non H264 encoded files and ffmpeg them into web shape.
>
> > Do you have any script at all?
>
> yeah. Ive got it working well enough now for te one ogf use IO need it for.
> >
> > What errors do you receive?
>
> So many I lost count, and did things a different way.
>
> Mostly the utterly inconsistent treatment of white space or the lack of it.
>
> I wrote a small bit in C - its strips the extension from a file path if
> it has one.
basename (1)
SEE ALSO
dirname(1)
>
> I couldn't believe that there wasn't a unix utility to do this..
>
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> // strip extension from file path
> main(int argc, char **argv)
> {
> char *path;
> int len;
> if (argc==1)
> exit(0);
> path=argv[1];
> len=strlen(path);
> do
> {
> if(path[len]=='/') // we havent found a period so no extension
> break;
> if (path[len]=='.') // we have
> {
> path[len]=0;
> break;
> }
> }
> while (--len);
> printf("%s",path);
> }
>
>
>
>
> >
> > Is this a serious question or are you a troll?
> >
> Yes. No. I was venting my frustration. Bourne was a twat. So was the guy
> that wrote PERL. And the one that invented regex
>
> Compared with their divinesseses, Kernighan and Ritchie.
> > Jack
> >
>
>
--
Robert Heller -- 978-544-6933 Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2020-06-22 12:41 -0400 |
| Message-ID | <rcqmvb$v06$1@dont-email.me> |
| In reply to | #30172 |
On June 22, 2020 12:05, The Natural Philosopher wrote:
> On 22/06/2020 15:01, Jack Strangio wrote:
>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>> It simply doesn't behave as the manual says it does.
>>> 6 hours and counting for a 4 line script...sigh. quicker to write in 'C'
>>>
>>
>> Which shell are you writing the script in?
>>
>> Are you using a valid 'hash-bang' line to specify the executing
>> shell or program? as in
>>
>> #!/bin/bash
>>
>> as the first line.
> Of course.
>
>>
>> Otherwise it will very likely revert to the 'sh' shell which uses
>> different syntax to 'bash' or 'csh' or 'zsh'.
>>
>> Are you using the correct manual?
>>
> What manual?
>
>> What are you trying to do?
>>
>
> recursively look for non H264 encoded files and ffmpeg them into web
> shape.
seems simple enough. a rough mixture of find(1), file(1), ffmpeg(1), and a
few standard utilities to glue it all together. What, specifically, is
causing you problems?
>> Do you have any script at all?
>
> yeah. Ive got it working well enough now for te one ogf use IO need it
> for.
>>
>> What errors do you receive?
>
> So many I lost count, and did things a different way.
>
> Mostly the utterly inconsistent treatment of white space or the lack of
> it.
>
> I wrote a small bit in C - its strips the extension from a file path if
> it has one.
Oh? like basename(1)? or, perhaps ${parameter%word} ?
> I couldn't believe that there wasn't a unix utility to do this..
Oh. Like ${parameter%word}
12:38 $ A=b/c/d.e.f
12:40 $ echo ${A%.*}
b/c/d.e
12:40 $
(or, perhaps, a combination of dirname(1) and basename(1)) then
[snip]
HTH
--
Lew Pitcher
"In Skills, We Trust"
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2020-06-22 18:49 +0100 |
| Message-ID | <rcqqvb$t6t$2@dont-email.me> |
| In reply to | #30175 |
On 22/06/2020 17:41, Lew Pitcher wrote:
> On June 22, 2020 12:05, The Natural Philosopher wrote:
>
>> On 22/06/2020 15:01, Jack Strangio wrote:
>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>> It simply doesn't behave as the manual says it does.
>>>> 6 hours and counting for a 4 line script...sigh. quicker to write in 'C'
>>>>
>>>
>>> Which shell are you writing the script in?
>>>
>>> Are you using a valid 'hash-bang' line to specify the executing
>>> shell or program? as in
>>>
>>> #!/bin/bash
>>>
>>> as the first line.
>> Of course.
>>
>>>
>>> Otherwise it will very likely revert to the 'sh' shell which uses
>>> different syntax to 'bash' or 'csh' or 'zsh'.
>>>
>>> Are you using the correct manual?
>>>
>> What manual?
>>
>>> What are you trying to do?
>>>
>>
>> recursively look for non H264 encoded files and ffmpeg them into web
>> shape.
>
> seems simple enough. a rough mixture of find(1), file(1), ffmpeg(1), and a
> few standard utilities to glue it all together. What, specifically, is
> causing you problems?
>
>>> Do you have any script at all?
>>
>> yeah. Ive got it working well enough now for te one ogf use IO need it
>> for.
>>>
>>> What errors do you receive?
>>
>> So many I lost count, and did things a different way.
>>
>> Mostly the utterly inconsistent treatment of white space or the lack of
>> it.
>>
>> I wrote a small bit in C - its strips the extension from a file path if
>> it has one.
>
> Oh? like basename(1)? or, perhaps ${parameter%word} ?
>
>> I couldn't believe that there wasn't a unix utility to do this..
>
> Oh. Like ${parameter%word}
> 12:38 $ A=b/c/d.e.f
> 12:40 $ echo ${A%.*}
> b/c/d.e
> 12:40 $
>
> (or, perhaps, a combination of dirname(1) and basename(1)) then
>
> [snip]
>
> HTH
>
well now its just strext "filename"
Much easier
--
"Corbyn talks about equality, justice, opportunity, health care, peace,
community, compassion, investment, security, housing...."
"What kind of person is not interested in those things?"
"Jeremy Corbyn?"
[toc] | [prev] | [next] | [standalone]
| From | Jack Strangio <jackstrangio@yahoo.com> |
|---|---|
| Date | 2020-06-22 21:50 +0000 |
| Message-ID | <qCCKo9.12oEI@yahoo.com> |
| In reply to | #30172 |
The Natural Philosopher <tnp@invalid.invalid> writes: > On 22/06/2020 15:01, Jack Strangio wrote: > > > > Are you using the correct manual? > > > What manual? > Here's a few articles (There are *hundreds* more on the Web): Bash Guide for Beginners http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html Advanced Bash-Scripting Guide http://tldp.org/LDP/abs/html/ Bash Scripting: Learn to use REGEX (Basics) https://linuxtechlab.com/bash-scripting-learn-use-regex-basics/ > > I wrote a small bit in C - its strips the extension from a file path if > it has one. > I couldn't believe that there wasn't a unix utility to do this.. > As others have said already 'dirname' and 'basename' will do that for you As always, Google/DuckDuckGo is there at your side, ever willing to help Jack -- "It's rather cold." she said bitchily.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2020-06-23 05:04 +0100 |
| Message-ID | <rcrv0b$4l8$1@dont-email.me> |
| In reply to | #30181 |
On 22/06/2020 22:50, Jack Strangio wrote:
> The Natural Philosopher <tnp@invalid.invalid> writes:
>> On 22/06/2020 15:01, Jack Strangio wrote:
>>>
>>> Are you using the correct manual?
>>>
>> What manual?
>>
>
> Here's a few articles (There are *hundreds* more on the Web):
>
> Bash Guide for Beginners
> http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html
>
> Advanced Bash-Scripting Guide
> http://tldp.org/LDP/abs/html/
>
> Bash Scripting: Learn to use REGEX (Basics)
> https://linuxtechlab.com/bash-scripting-learn-use-regex-basics/
>
>>
>> I wrote a small bit in C - its strips the extension from a file path if
>> it has one.
Well no they wont.
not individually and not together.
basename wont strip an *arbitrary* suffix as far as I can see
And searching the docs to see what arcane command might make it is
slower than writing what I did.
>
>
> As always, Google/DuckDuckGo is there at your side, ever willing to help
>
>
Yes they re. I think I found at least 6 different answesr to every
problem I had, none of which worked.
> Jack
>
--
“Ideas are inherently conservative. They yield not to the attack of
other ideas but to the massive onslaught of circumstance"
- John K Galbraith
[toc] | [prev] | [next] | [standalone]
| From | Aragorn <thorongil@telenet.be> |
|---|---|
| Date | 2020-06-23 10:15 +0200 |
| Message-ID | <20200623101537.25a04922@nx-74205> |
| In reply to | #30184 |
On 23.06.2020 at 05:04, The Natural Philosopher scribbled:
> On 22/06/2020 22:50, Jack Strangio wrote:
> > The Natural Philosopher <tnp@invalid.invalid> writes:
> >> On 22/06/2020 15:01, Jack Strangio wrote:
> >>>
> >>> Are you using the correct manual?
> >>>
> >> What manual?
> >>
> >
> > Here's a few articles (There are *hundreds* more on the Web):
> >
> > Bash Guide for Beginners
> > http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html
> >
> > Advanced Bash-Scripting Guide
> > http://tldp.org/LDP/abs/html/
> >
> > Bash Scripting: Learn to use REGEX (Basics)
> > https://linuxtechlab.com/bash-scripting-learn-use-regex-basics/
> >
> >>
> >> I wrote a small bit in C - its strips the extension from a file
> >> path if it has one.
> Well no they wont.
>
> not individually and not together.
>
> basename wont strip an *arbitrary* suffix as far as I can see
>
> And searching the docs to see what arcane command might make it is
> slower than writing what I did.
for video in *
do
name-without-suffix=$(basename ${video%.*})
# Do your encoding stuff here
done
--
With respect,
= Aragorn =
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2020-06-23 09:38 +0100 |
| Message-ID | <rcsf1d$9hs$2@dont-email.me> |
| In reply to | #30188 |
On 23/06/2020 09:15, Aragorn wrote:
> On 23.06.2020 at 05:04, The Natural Philosopher scribbled:
>
>> On 22/06/2020 22:50, Jack Strangio wrote:
>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>> On 22/06/2020 15:01, Jack Strangio wrote:
>>>>>
>>>>> Are you using the correct manual?
>>>>>
>>>> What manual?
>>>>
>>>
>>> Here's a few articles (There are *hundreds* more on the Web):
>>>
>>> Bash Guide for Beginners
>>> http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html
>>>
>>> Advanced Bash-Scripting Guide
>>> http://tldp.org/LDP/abs/html/
>>>
>>> Bash Scripting: Learn to use REGEX (Basics)
>>> https://linuxtechlab.com/bash-scripting-learn-use-regex-basics/
>>>
>>>>
>>>> I wrote a small bit in C - its strips the extension from a file
>>>> path if it has one.
>> Well no they wont.
>>
>> not individually and not together.
>>
>> basename wont strip an *arbitrary* suffix as far as I can see
>>
>> And searching the docs to see what arcane command might make it is
>> slower than writing what I did.
>
> for video in *
> do
> name-without-suffix=$(basename ${video%.*})
> # Do your encoding stuff here
> done
>
Now what happens when the video is called
/home/videos/New.files.uncalssified/Domination. A history of Linux.m2t
--
Climate Change: Socialism wearing a lab coat.
[toc] | [prev] | [next] | [standalone]
| From | Aragorn <thorongil@telenet.be> |
|---|---|
| Date | 2020-06-23 13:31 +0200 |
| Message-ID | <20200623133115.14b537b4@nx-74205> |
| In reply to | #30190 |
On 23.06.2020 at 09:38, The Natural Philosopher scribbled:
> On 23/06/2020 09:15, Aragorn wrote:
> > On 23.06.2020 at 05:04, The Natural Philosopher scribbled:
> >
> >> On 22/06/2020 22:50, Jack Strangio wrote:
> >>> The Natural Philosopher <tnp@invalid.invalid> writes:
> >>>> On 22/06/2020 15:01, Jack Strangio wrote:
> >>>>>
> >>>>> Are you using the correct manual?
> >>>>>
> >>>> What manual?
> >>>>
> >>>
> >>> Here's a few articles (There are *hundreds* more on the Web):
> >>>
> >>> Bash Guide for Beginners
> >>> http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html
> >>>
> >>> Advanced Bash-Scripting Guide
> >>> http://tldp.org/LDP/abs/html/
> >>>
> >>> Bash Scripting: Learn to use REGEX (Basics)
> >>> https://linuxtechlab.com/bash-scripting-learn-use-regex-basics/
> >>>
> >>>>
> >>>> I wrote a small bit in C - its strips the extension from a file
> >>>> path if it has one.
> >> Well no they wont.
> >>
> >> not individually and not together.
> >>
> >> basename wont strip an *arbitrary* suffix as far as I can see
> >>
> >> And searching the docs to see what arcane command might make it is
> >> slower than writing what I did.
> >
> > for video in *
> > do
> > name-without-suffix=$(basename ${video%.*})
> > # Do your encoding stuff here
> > done
> >
> Now what happens when the video is called
>
> /home/videos/New.files.uncalssified/Domination. A history of Linux.m2t
Add proper quoting to my code snippet above in order to work around
filenames with spaces, and read the Bash manual. It takes less time for
you to do either than for me to learn C.
--
With respect,
= Aragorn =
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2020-06-23 14:09 +0100 |
| Message-ID | <rcsuua$hd9$1@dont-email.me> |
| In reply to | #30193 |
On 23/06/2020 12:31, Aragorn wrote:
> On 23.06.2020 at 09:38, The Natural Philosopher scribbled:
>
>> On 23/06/2020 09:15, Aragorn wrote:
>>> On 23.06.2020 at 05:04, The Natural Philosopher scribbled:
>>>
>>>> On 22/06/2020 22:50, Jack Strangio wrote:
>>>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>>>> On 22/06/2020 15:01, Jack Strangio wrote:
>>>>>>>
>>>>>>> Are you using the correct manual?
>>>>>>>
>>>>>> What manual?
>>>>>>
>>>>>
>>>>> Here's a few articles (There are *hundreds* more on the Web):
>>>>>
>>>>> Bash Guide for Beginners
>>>>> http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html
>>>>>
>>>>> Advanced Bash-Scripting Guide
>>>>> http://tldp.org/LDP/abs/html/
>>>>>
>>>>> Bash Scripting: Learn to use REGEX (Basics)
>>>>> https://linuxtechlab.com/bash-scripting-learn-use-regex-basics/
>>>>>
>>>>>>
>>>>>> I wrote a small bit in C - its strips the extension from a file
>>>>>> path if it has one.
>>>> Well no they wont.
>>>>
>>>> not individually and not together.
>>>>
>>>> basename wont strip an *arbitrary* suffix as far as I can see
>>>>
>>>> And searching the docs to see what arcane command might make it is
>>>> slower than writing what I did.
>>>
>>> for video in *
>>> do
>>> name-without-suffix=$(basename ${video%.*})
>>> # Do your encoding stuff here
>>> done
>>>
>> Now what happens when the video is called
>>
>> /home/videos/New.files.uncalssified/Domination. A history of Linux.m2t
>
> Add proper quoting to my code snippet above in order to work around
> filenames with spaces, and read the Bash manual. It takes less time for
> you to do either than for me to learn C.
>
considering your bigotry, I suppose it would take you a long time to
learn the one language you really need for Linux
But that is your problem, not mine.
--
“It is not the truth of Marxism that explains the willingness of
intellectuals to believe it, but the power that it confers on
intellectuals, in their attempts to control the world. And since...it is
futile to reason someone out of a thing that he was not reasoned into,
we can conclude that Marxism owes its remarkable power to survive every
criticism to the fact that it is not a truth-directed but a
power-directed system of thought.”
Sir Roger Scruton
[toc] | [prev] | [next] | [standalone]
| From | Aragorn <thorongil@telenet.be> |
|---|---|
| Date | 2020-06-23 15:58 +0200 |
| Message-ID | <20200623155827.1c9ff507@nx-74205> |
| In reply to | #30195 |
On 23.06.2020 at 14:09, The Natural Philosopher scribbled:
> On 23/06/2020 12:31, Aragorn wrote:
> > On 23.06.2020 at 09:38, The Natural Philosopher scribbled:
> >
> >> On 23/06/2020 09:15, Aragorn wrote:
> >>> On 23.06.2020 at 05:04, The Natural Philosopher scribbled:
> >>>
> >>>> On 22/06/2020 22:50, Jack Strangio wrote:
> >>>>> The Natural Philosopher <tnp@invalid.invalid> writes:
> >>>>>> On 22/06/2020 15:01, Jack Strangio wrote:
> >>>>>>>
> >>>>>>> Are you using the correct manual?
> >>>>>>>
> >>>>>> What manual?
> >>>>>>
> >>>>>
> >>>>> Here's a few articles (There are *hundreds* more on the Web):
> >>>>>
> >>>>> Bash Guide for Beginners
> >>>>> http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html
> >>>>>
> >>>>> Advanced Bash-Scripting Guide
> >>>>> http://tldp.org/LDP/abs/html/
> >>>>>
> >>>>> Bash Scripting: Learn to use REGEX (Basics)
> >>>>> https://linuxtechlab.com/bash-scripting-learn-use-regex-basics/
> >>>>>
> >>>>>>
> >>>>>> I wrote a small bit in C - its strips the extension from a file
> >>>>>> path if it has one.
> >>>> Well no they wont.
> >>>>
> >>>> not individually and not together.
> >>>>
> >>>> basename wont strip an *arbitrary* suffix as far as I can see
> >>>>
> >>>> And searching the docs to see what arcane command might make it
> >>>> is slower than writing what I did.
> >>>
> >>> for video in *
> >>> do
> >>> name-without-suffix=$(basename ${video%.*})
> >>> # Do your encoding stuff here
> >>> done
> >>>
> >> Now what happens when the video is called
> >>
> >> /home/videos/New.files.uncalssified/Domination. A history of
> >> Linux.m2t
> >
> > Add proper quoting to my code snippet above in order to work around
> > filenames with spaces, and read the Bash manual. It takes less time
> > for you to do either than for me to learn C.
> >
> considering your bigotry, I suppose it would take you a long time to
> learn the one language you really need for Linux
>
> But that is your problem, not mine.
MY bigotry? Oh boy...
Tell you what, I'll just do what most other members of this newsgroup
have already done a long time ago and add you to my killfile.
Bye now...!
--
With respect,
= Aragorn =
[toc] | [prev] | [next] | [standalone]
| From | Harold Stevens <wookie@fossa.localdomain> |
|---|---|
| Date | 2020-06-23 09:16 -0500 |
| Message-ID | <slrnrf43mm.4id.wookie@fossa.localdomain> |
| In reply to | #30196 |
In <20200623155827.1c9ff507@nx-74205> Aragorn: [Snip ...] > already done a long time ago and add you to my killfile [Me raises hand ...] The noise reduction alone is considerable. Highly recommended. > Bye now...! +1 -- Regards, Weird (Harold Stevens) * IMPORTANT EMAIL INFO FOLLOWS * Pardon any bogus email addresses (wookie) in place for spambots. Really, it's (wyrd) at att, dotted with net. * DO NOT SPAM IT. * I toss GoogleGroup (http://twovoyagers.com/improve-usenet.org/).
[toc] | [prev] | [next] | [standalone]
| From | Joe Beanfish <joebeanfish@nospam.duh> |
|---|---|
| Date | 2020-06-23 14:17 +0000 |
| Message-ID | <rct2u2$4f7$1@dont-email.me> |
| In reply to | #30188 |
On Tue, 23 Jun 2020 10:15:37 +0200, Aragorn wrote:
>
> for video in *
> do
> name-without-suffix=$(basename ${video%.*})
> # Do your encoding stuff here
> done
Hyphens aren't valid in variable names. Use underscore or camelCase
or something. Add quotes to handle spaces in file names.
name_without_suffix=$(basename "${video%.*}")
When someone's struggling with shell syntax, it helps to use
syntactically valid examples. Saying "here's my pseudo-code
example, go rtfm to fix it" doesn't help.
[toc] | [prev] | [next] | [standalone]
| From | Aragorn <thorongil@telenet.be> |
|---|---|
| Date | 2020-06-23 16:58 +0200 |
| Message-ID | <20200623165834.592758d0@nx-74205> |
| In reply to | #30198 |
On 23.06.2020 at 14:17, Joe Beanfish scribbled:
> On Tue, 23 Jun 2020 10:15:37 +0200, Aragorn wrote:
> >
> > for video in *
> > do
> > name-without-suffix=$(basename ${video%.*})
> > # Do your encoding stuff here
> > done
>
> Hyphens aren't valid in variable names. Use underscore or camelCase
> or something. Add quotes to handle spaces in file names.
I know that. It wasn't meant to be taken literally.
> name_without_suffix=$(basename "${video%.*}")
>
> When someone's struggling with shell syntax, it helps to use
> syntactically valid examples. Saying "here's my pseudo-code
> example, go rtfm to fix it" doesn't help.
He's been around for so long that he ought to have known about these
things things better than I do. He wasn't struggling at all. He's just
deliberately being obtuse so as to warrant a diatribe against shell
syntax.
--
With respect,
= Aragorn =
[toc] | [prev] | [next] | [standalone]
| From | Rich <rich@example.invalid> |
|---|---|
| Date | 2020-06-23 16:47 +0000 |
| Message-ID | <rctbmh$46n$1@dont-email.me> |
| In reply to | #30199 |
Aragorn <thorongil@telenet.be> wrote:
> On 23.06.2020 at 14:17, Joe Beanfish scribbled:
>
>> On Tue, 23 Jun 2020 10:15:37 +0200, Aragorn wrote:
>> >
>> > for video in *
>> > do
>> > name-without-suffix=$(basename ${video%.*})
>> > # Do your encoding stuff here
>> > done
>>
>> Hyphens aren't valid in variable names. Use underscore or camelCase
>> or something. Add quotes to handle spaces in file names.
>
> I know that. It wasn't meant to be taken literally.
>
>> name_without_suffix=$(basename "${video%.*}")
>>
>> When someone's struggling with shell syntax, it helps to use
>> syntactically valid examples. Saying "here's my pseudo-code
>> example, go rtfm to fix it" doesn't help.
>
> He's been around for so long that he ought to have known about these
> things things better than I do. He wasn't struggling at all. He's just
> deliberately being obtuse so as to warrant a diatribe against shell
> syntax.
Back in March, on this article:
Subject: Re: How long should a dd take
Date: Fri, 27 Mar 2020 10:15:56 +0000
Message-ID: <r5kjot$kkh$1@dont-email.me>
He made this statement:
Ive been running *nix systems for 30 years. How about you?
So yes, if his assertion back then was correct, he ought to have known
about these things better than many here in the group.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2020-06-23 19:13 +0100 |
| Message-ID | <rctgp5$h92$1@dont-email.me> |
| In reply to | #30200 |
On 23/06/2020 17:47, Rich wrote:
> Aragorn <thorongil@telenet.be> wrote:
>> On 23.06.2020 at 14:17, Joe Beanfish scribbled:
>>
>>> On Tue, 23 Jun 2020 10:15:37 +0200, Aragorn wrote:
>>>>
>>>> for video in *
>>>> do
>>>> name-without-suffix=$(basename ${video%.*})
>>>> # Do your encoding stuff here
>>>> done
>>>
>>> Hyphens aren't valid in variable names. Use underscore or camelCase
>>> or something. Add quotes to handle spaces in file names.
>>
>> I know that. It wasn't meant to be taken literally.
>>
>>> name_without_suffix=$(basename "${video%.*}")
>>>
>>> When someone's struggling with shell syntax, it helps to use
>>> syntactically valid examples. Saying "here's my pseudo-code
>>> example, go rtfm to fix it" doesn't help.
>>
>> He's been around for so long that he ought to have known about these
>> things things better than I do. He wasn't struggling at all. He's just
>> deliberately being obtuse so as to warrant a diatribe against shell
>> syntax.
>
> Back in March, on this article:
>
> Subject: Re: How long should a dd take
> Date: Fri, 27 Mar 2020 10:15:56 +0000
> Message-ID: <r5kjot$kkh$1@dont-email.me>
>
> He made this statement:
>
> Ive been running *nix systems for 30 years. How about you?
>
> So yes, if his assertion back then was correct, he ought to have known
> about these things better than many here in the group.
>
I never ever use shell unless I have to. Or regex.Or PERL. They are all
crap languages used by mainly arseholes.
I have a better opinion of awk..
--
"Anyone who believes that the laws of physics are mere social
conventions is invited to try transgressing those conventions from the
windows of my apartment. (I live on the twenty-first floor.) "
Alan Sokal
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.os.linux.misc
csiph-web