Writing shell scripts to automate
Writing shell scripts to automate
am 05.04.2008 04:53:22 von 2007
Hi
I did a lot of shell scripts to automate but forgot.
Could someone help me to refresh? Say,
I have a set of files, say 80 of them.
I need to take them, one at a time, and run another program (*.exe) -
possibly different file name.
Could someone please give me a sample code, to get me started?
Thanks
Re: Writing shell scripts to automate
am 05.04.2008 05:31:37 von Barry Margolin
In article
<32e6209b-7292-4c43-9623-caa6b7db5779@t36g2000prm.googlegroups.com>,
2007 wrote:
> Hi
>
> I did a lot of shell scripts to automate but forgot.
>
> Could someone help me to refresh? Say,
>
> I have a set of files, say 80 of them.
>
> I need to take them, one at a time, and run another program (*.exe) -
> possibly different file name.
>
> Could someone please give me a sample code, to get me started?
>
> Thanks
I find it difficult to believe that someone who has done lots of shell
scripts could "forget" such a simple thing. It's like saying that
you've baked lots of cakes, but you've forgotten how to mix batter.
You're obviously asking us to do your homework for you, but you're too
embarassed to say so.
But you haven't even given us a good description of what your script
needs to do. You say "possibly different file name" -- where does this
different file name come from?
And Unix programs don't usually end in .exe, that's Windows.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE don't copy me on replies, I'll read them in the group ***
Re: Writing shell scripts to automate
am 05.04.2008 06:03:20 von Ignoramus20845
for i in *.xyz; do
myprog "$i"
done
On 2008-04-05, 2007 wrote:
> Hi
>
> I did a lot of shell scripts to automate but forgot.
>
> Could someone help me to refresh? Say,
>
> I have a set of files, say 80 of them.
>
> I need to take them, one at a time, and run another program (*.exe) -
> possibly different file name.
>
> Could someone please give me a sample code, to get me started?
>
> Thanks
Re: Writing shell scripts to automate
am 05.04.2008 06:55:00 von 2007
On Apr 4, 8:31 pm, Barry Margolin wrote:
> In article
> <32e6209b-7292-4c43-9623-caa6b7db5...@t36g2000prm.googlegroups.com>,
>
> 2007 wrote:
> > Hi
>
> > I did a lot of shell scripts to automate but forgot.
>
> > Could someone help me to refresh? Say,
>
> > I have a set of files, say 80 of them.
>
> > I need to take them, one at a time, and run another program (*.exe) -
> > possibly different file name.
>
> > Could someone please give me a sample code, to get me started?
>
> > Thanks
>
> I find it difficult to believe that someone who has done lots of shell
> scripts could "forget" such a simple thing. It's like saying that
> you've baked lots of cakes, but you've forgotten how to mix batter.
>
> You're obviously asking us to do your homework for you, but you're too
> embarassed to say so.
>
> But you haven't even given us a good description of what your script
> needs to do. You say "possibly different file name" -- where does this
> different file name come from?
>
> And Unix programs don't usually end in .exe, that's Windows.
>
> --
> Barry Margolin, bar...@alum.mit.edu
> Arlington, MA
> *** PLEASE don't copy me on replies, I'll read them in the group ***
I have a file called "list1" - its got about 80 rows - each row is
alpha numeric name w/ ".txt" extension - each name refers to a file in
the dir.
The script reads the list - for each name in the list, it will perform
an operation and writes to same name with a different extension, say
".mp3".
Thanks
Re: Writing shell scripts to automate
am 05.04.2008 08:00:14 von Bit Twister
On Fri, 4 Apr 2008 19:53:22 -0700 (PDT), 2007 wrote:
> Hi
>
> I did a lot of shell scripts to automate but forgot.
>
> Could someone help me to refresh?
http://tldp.org/LDP/abs/html/index.html
Re: Writing shell scripts to automate
am 05.04.2008 13:51:03 von Harold Stevens
["Followup-To:" header set to comp.os.linux.misc.]
In Barry Margolin:
[Snip...]
> someone who has done lots of shell scripts could "forget"
Well, there's that mean old instructor giving pop quizzes and all... :)
> And Unix programs don't usually end in .exe, that's Windows.
Another boat anchor MCSE got "surplused" and is looking for a real job.
--
Regards, Weird (Harold Stevens) * IMPORTANT EMAIL INFO FOLLOWS *
Pardon any bogus email addresses (wookie) in place for spambots.
Really, it's (wyrd) at airmail, dotted with net. DO NOT SPAM IT.
Kids jumping ship? Looking to hire an old-school type? Email me.
Re: Writing shell scripts to automate
am 05.04.2008 15:04:37 von Ed Morton
On 4/4/2008 11:55 PM, 2007 wrote:
> On Apr 4, 8:31 pm, Barry Margolin wrote:
>
>>In article
>><32e6209b-7292-4c43-9623-caa6b7db5...@t36g2000prm.googlegroups.com>,
>>
>> 2007 wrote:
>>
>>>Hi
>>
>>>I did a lot of shell scripts to automate but forgot.
>>
>>>Could someone help me to refresh? Say,
>>
>>>I have a set of files, say 80 of them.
>>
>>>I need to take them, one at a time, and run another program (*.exe) -
>>>possibly different file name.
>>
>>>Could someone please give me a sample code, to get me started?
>>
>>>Thanks
>>
>>I find it difficult to believe that someone who has done lots of shell
>>scripts could "forget" such a simple thing. It's like saying that
>>you've baked lots of cakes, but you've forgotten how to mix batter.
>>
>>You're obviously asking us to do your homework for you, but you're too
>>embarassed to say so.
>>
>>But you haven't even given us a good description of what your script
>>needs to do. You say "possibly different file name" -- where does this
>>different file name come from?
>>
>>And Unix programs don't usually end in .exe, that's Windows.
>>
>>--
>>Barry Margolin, bar...@alum.mit.edu
>>Arlington, MA
>>*** PLEASE don't copy me on replies, I'll read them in the group ***
>
>
> I have a file called "list1" - its got about 80 rows - each row is
> alpha numeric name w/ ".txt" extension - each name refers to a file in
> the dir.
>
> The script reads the list - for each name in the list, it will perform
> an operation and writes to same name with a different extension, say
> ".mp3".
>
> Thanks
while IFS= read -r file; do
operation "$file" > "${file%.txt}.mp3"
done < list1
If you're concerned abpout name clashes with existing ".mp3" files, test for
them and come up with a different name or move them or....
I figure even if it's homework, he still has to explain it.
Ed.
Re: Writing shell scripts to automate
am 05.04.2008 20:19:54 von 2007
On Apr 5, 6:04 am, Ed Morton wrote:
> On 4/4/2008 11:55 PM, 2007 wrote:
>
>
>
> > On Apr 4, 8:31 pm, Barry Margolin wrote:
>
> >>In article
> >><32e6209b-7292-4c43-9623-caa6b7db5...@t36g2000prm.googlegroups.com>,
>
> >> 2007 wrote:
>
> >>>Hi
>
> >>>I did a lot of shell scripts to automate but forgot.
>
> >>>Could someone help me to refresh? Say,
>
> >>>I have a set of files, say 80 of them.
>
> >>>I need to take them, one at a time, and run another program (*.exe) -
> >>>possibly different file name.
>
> >>>Could someone please give me a sample code, to get me started?
>
> >>>Thanks
>
> >>I find it difficult to believe that someone who has done lots of shell
> >>scripts could "forget" such a simple thing. It's like saying that
> >>you've baked lots of cakes, but you've forgotten how to mix batter.
>
> >>You're obviously asking us to do your homework for you, but you're too
> >>embarassed to say so.
>
> >>But you haven't even given us a good description of what your script
> >>needs to do. You say "possibly different file name" -- where does this
> >>different file name come from?
>
> >>And Unix programs don't usually end in .exe, that's Windows.
>
> >>--
> >>Barry Margolin, bar...@alum.mit.edu
> >>Arlington, MA
> >>*** PLEASE don't copy me on replies, I'll read them in the group ***
>
> > I have a file called "list1" - its got about 80 rows - each row is
> > alpha numeric name w/ ".txt" extension - each name refers to a file in
> > the dir.
>
> > The script reads the list - for each name in the list, it will perform
> > an operation and writes to same name with a different extension, say
> > ".mp3".
>
> > Thanks
>
> while IFS= read -r file; do
> operation "$file" > "${file%.txt}.mp3"
> done < list1
>
> If you're concerned abpout name clashes with existing ".mp3" files, test for
> them and come up with a different name or move them or....
>
> I figure even if it's homework, he still has to explain it.
>
> Ed.
It is tcsh - t shell
The IFS is not recognized - how should I change it?
Re: Writing shell scripts to automate
am 06.04.2008 01:34:28 von Ed Morton
On 4/5/2008 1:19 PM, 2007 wrote:
> On Apr 5, 6:04 am, Ed Morton wrote:
>
>>On 4/4/2008 11:55 PM, 2007 wrote:
>>
>>
>>
>>
>>>On Apr 4, 8:31 pm, Barry Margolin wrote:
>>
>>>>In article
>>>><32e6209b-7292-4c43-9623-caa6b7db5...@t36g2000prm.googlegroups.com>,
>>>
>>>>2007 wrote:
>>>
>>>>>Hi
>>>>
>>>>>I did a lot of shell scripts to automate but forgot.
>>>>
>>>>>Could someone help me to refresh? Say,
>>>>
>>>>>I have a set of files, say 80 of them.
>>>>
>>>>>I need to take them, one at a time, and run another program (*.exe) -
>>>>>possibly different file name.
>>>>
>>>>>Could someone please give me a sample code, to get me started?
>>>>
>>>>>Thanks
>>>>
>>>>I find it difficult to believe that someone who has done lots of shell
>>>>scripts could "forget" such a simple thing. It's like saying that
>>>>you've baked lots of cakes, but you've forgotten how to mix batter.
>>>
>>>>You're obviously asking us to do your homework for you, but you're too
>>>>embarassed to say so.
>>>
>>>>But you haven't even given us a good description of what your script
>>>>needs to do. You say "possibly different file name" -- where does this
>>>>different file name come from?
>>>
>>>>And Unix programs don't usually end in .exe, that's Windows.
>>>
>>>>--
>>>>Barry Margolin, bar...@alum.mit.edu
>>>>Arlington, MA
>>>>*** PLEASE don't copy me on replies, I'll read them in the group ***
>>>
>>>I have a file called "list1" - its got about 80 rows - each row is
>>>alpha numeric name w/ ".txt" extension - each name refers to a file in
>>>the dir.
>>
>>>The script reads the list - for each name in the list, it will perform
>>>an operation and writes to same name with a different extension, say
>>>".mp3".
>>
>>>Thanks
>>
>>while IFS= read -r file; do
>> operation "$file" > "${file%.txt}.mp3"
>>done < list1
>>
>>If you're concerned abpout name clashes with existing ".mp3" files, test for
>>them and come up with a different name or move them or....
>>
>>I figure even if it's homework, he still has to explain it.
>>
>> Ed.
>
>
> It is tcsh - t shell
>
> The IFS is not recognized - how should I change it?
>
Change your shell for writing scripts. See
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ and/or google "c shell why not".
Ed.
Re: Writing shell scripts to automate
am 06.04.2008 15:52:11 von gazelle
In article <47F80C84.8020906@lsupcaemnt.com>,
Ed Morton wrote:
....
>Change your shell for writing scripts. See
>http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ and/or google "c
>shell why not".
This advice is about the same as:
Q: My husband isn't a good bowler. His average is only 167.
What should I do?
A: Get a divorce and find a better guy to marry.
Something about forrests and trees...
Re: Writing shell scripts to automate
am 06.04.2008 18:34:28 von Chris Mattern
On 2008-04-06, Kenny McCormack wrote:
> In article <47F80C84.8020906@lsupcaemnt.com>,
> Ed Morton wrote:
> ...
>>Change your shell for writing scripts. See
>>http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ and/or google "c
>>shell why not".
>
> This advice is about the same as:
>
> Q: My husband isn't a good bowler. His average is only 167.
> What should I do?
> A: Get a divorce and find a better guy to marry.
>
> Something about forrests and trees...
>
No, it's more like
A: Maybe if he stopped using the square bowling ball...
Nobody's saying that you must immediately go out and replace all the
csh scripts you currently have. But there's no reason to write *more*
csh scripts, and if you have a csh script that's going through a major
rewrite, or a rewrite where csh's limitations are giving you grief,
you can port that one over. That's generally faster than trying to
code around csh's problems.
--
Christopher Mattern
NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities