Re: Shell script question

2006-04-02 Thread Michelle Konzack
Am 2006-03-22 09:43:57, schrieb Andras Lorincz: > ENTRY=$(cat input_file) > > for I in $ENTRY > do > ... > done > > I found a solution for this: > > LINES=$(wc -l input_file) > while [ $LINES -gt 0 ] > do > ENTRY=$(sed -e '1q' input_file) > #do smth > sed -e '2,$w input_file' input_file >

Re: Shell script question

2006-03-24 Thread Mario 'BitKoenig' Holbe
Luis R Finotti <[EMAIL PROTECTED]> wrote: > Mario 'BitKoenig' Holbe wrote: >> while read i; do >> echo "$i" >> done < input_file > And if the spaces give you trouble, add They don't. regards Mario -- There are two major products that come from Berkeley: LSD and UNIX. We don't believe th

Re: Shell script question

2006-03-22 Thread Bob McGowan
The generally accepted way to deal with IFS is to save the current value and restore when done: ifs=$IFS IFS=' ' ... IFS=$ifs But, of course, this is a change local to the script being run, so when it exits, the change would be 'forgotten' anyway, since it's local to the sub shell that was ru

Re: Shell script question

2006-03-22 Thread Luis R Finotti
Mario 'BitKoenig' Holbe wrote: Andras Lorincz <[EMAIL PROTECTED]> wrote: ENTRY=3D$(cat input_file) for I in $ENTRY while read i; do echo "$i" done < input_file regards Mario And if the spaces give you trouble, add - IFS=' ' - That's just a "newline" between t

Re: Shell script question

2006-03-22 Thread Mario 'BitKoenig' Holbe
Andras Lorincz <[EMAIL PROTECTED]> wrote: > ENTRY=3D$(cat input_file) > for I in $ENTRY while read i; do echo "$i" done < input_file regards Mario -- reich sein heisst nicht, einen Ferrari zu kaufen, sondern einen zu verbrennen Dietmar W

Re: shell script question

2004-01-26 Thread Johann Spies
On Mon, Jan 26, 2004 at 10:36:13AM -0200, Leandro Guimarães Faria Corcete Dutra wrote: > Em Sáb, 2004-01-24 às 04:44, tripolar escreveu: > > I would like to download all files from an ftp site. probably 250 files > > some between 25-50 Megs.I am wondering about using wget with shell ( > > bash) scr

Re: shell script question

2004-01-26 Thread Leandro Guimarães Faria Corcete Dutra
Em SÃb, 2004-01-24 Ãs 04:44, tripolar escreveu: > I would like to download all files from an ftp site. probably 250 files > some between 25-50 Megs.I am wondering about using wget with shell ( > bash) script to login, download all files, if one is found on harddrive > ignore and goto next one. one

Re: shell script question

2004-01-26 Thread Jan Minar
On Sat, Jan 24, 2004 at 02:26:49PM +0100, Matthias Hentges wrote: > There's no need for a script. Just use wget -> man wget. Or ncftp. HTH. -- Jan Minar "Please don't CC me, I'm subscribed." x 9 pgp0.pgp Description: PGP signature

Re: shell script question

2004-01-24 Thread Matthias Hentges
Am Sam, 2004-01-24 um 07.44 schrieb tripolar: > I would like to download all files from an ftp site. probably 250 files > some between 25-50 Megs.I am wondering about using wget with shell ( > bash) script to login, download all files, if one is found on harddrive > ignore and goto next one. one fi

Re: shell script question

2003-12-05 Thread Andrew Schulman
> Is there any way to export a variable for one parent shell to a different > parent shell? No. But what you can do is to have your child script output a set of assignment statements, which can then be executed by the parent. For example if 'child' is a script that writes FOO=bar BAD=good t

Re: shell script question

2003-12-05 Thread David Z Maze
"Han Huynh" <[EMAIL PROTECTED]> writes: > I know this isn't a bash/korn shell script news group, but the fact is > I can't find one. Since bash/ksh is the default linux shell, I was > hoping someone could answer a few pretty simple questions. > > Is there any way to export a variable for one par

Re: shell script question

2003-12-05 Thread HdV
On Fri, 5 Dec 2003, Han Huynh wrote: > Is there any way to export a variable for one parent shell to a different > parent shell? I know that export will work to a subshell, but I can't find > any process to return a variable to a different parent shell. I am not sure I understand your question,

Re: shell script question

2003-10-13 Thread Jeff Elkins
On Monday 13 October 2003 4:39 am, Rob Weir wrote: >You're not converting an mp3 to a wav and then back again, are you? Have to, unless you know of a utility that will repair mp3s. I suspect the original encoder was sloppy, but these in particular report garbage in the headers, plus other proble

Re: shell script question

2003-10-13 Thread Colin Watson
On Mon, Oct 13, 2003 at 11:27:23AM -0400, David Z Maze wrote: > Carlos Sousa <[EMAIL PROTECTED]> writes: > > On Mon, 13 Oct 2003 08:30:23 +0100 Colin Watson wrote: > >> Here's a little expression that strips off any trailing "." > >> from $1 and tacks on ".wav". > >> > >> "${1%.*}.wav" > > > > T

Re: shell script question

2003-10-13 Thread David Z Maze
Carlos Sousa <[EMAIL PROTECTED]> writes: > On Mon, 13 Oct 2003 08:30:23 +0100 Colin Watson wrote: > >> Here's a little expression that strips off any trailing "." >> from $1 and tacks on ".wav". >> >> "${1%.*}.wav" > > That's much better, no dependency on yet another utility, so more portable >

Re: shell script question

2003-10-13 Thread Rob Weir
begin Jeff Elkins quote from Sun, Oct 12, 2003 at 11:18:11PM -0400 > In the same vein, I'm working through a list of mp3s where some of them need > re-encoding. First, I convert them to wavs with this script fragment: > > mpg123 -b 1 -s "$1" | sox -t raw -r 44100 -s -w -c2 - "$2" You're not

Re: shell script question

2003-10-13 Thread Carlos Sousa
On Mon, 13 Oct 2003 08:30:23 +0100 Colin Watson wrote: > On Sun, Oct 12, 2003 at 11:18:11PM -0400, Jeff Elkins wrote: > > mpg123 -b 1 -s "$1" | sox -t raw -r 44100 -s -w -c2 - "$2" > > > > In every case, $1 and $2 are the same, except for $2 I want the output > > filename to have a .wav extens

Re: shell script question

2003-10-13 Thread Colin Watson
On Sun, Oct 12, 2003 at 11:18:11PM -0400, Jeff Elkins wrote: > In the same vein, I'm working through a list of mp3s where some of them need > re-encoding. First, I convert them to wavs with this script fragment: > > mpg123 -b 1 -s "$1" | sox -t raw -r 44100 -s -w -c2 - "$2" > > where I feed

Re: shell script question

2003-10-12 Thread Carlos Sousa
On Sun, 12 Oct 2003 23:18:11 -0400 Jeff Elkins wrote: > > In the same vein, I'm working through a list of mp3s where some of them need > re-encoding. First, I convert them to wavs with this script fragment: > > mpg123 -b 1 -s "$1" | sox -t raw -r 44100 -s -w -c2 - "$2" > > where I feed the

Re: shell script question

2003-10-12 Thread Jeff Elkins
On Sunday 12 October 2003 10:35 pm, Jeff Elkins wrote: >On Sunday 12 October 2003 6:50 pm, Colin Watson wrote: >>On Sun, Oct 12, 2003 at 06:37:16PM -0400, Jeff Elkins wrote: >>> I'm trying to write a script to change spaces in a filename to the >>> underscore character: >>> >>> #!/bin/sh >>> for i

Re: shell script question

2003-10-12 Thread Jeff Elkins
On Sunday 12 October 2003 6:50 pm, Colin Watson wrote: >On Sun, Oct 12, 2003 at 06:37:16PM -0400, Jeff Elkins wrote: >> I'm trying to write a script to change spaces in a filename to the >> underscore character: >> >> #!/bin/sh >> for i in *; do >> if test -f $i; then >> mv $i `ec

Re: shell script question

2003-10-12 Thread Colin Watson
On Sun, Oct 12, 2003 at 06:37:16PM -0400, Jeff Elkins wrote: > I'm trying to write a script to change spaces in a filename to the > underscore character: > > #!/bin/sh > for i in *; do > if test -f $i; then > mv $i `echo $i | tr '" "' '_'` > fi > done > > When run, it gives

Re: Shell-script question

2001-02-11 Thread Ethan Benson
On Sun, Feb 11, 2001 at 09:07:02AM -0600, ktb wrote: > > I missed the first part of this so I apologize if I'm repeating but make > the permissions of your script something like - > -rwxrw-rwx1 root root > and see if that helps. no don't, that is a huge security hole. the permissions sh

Re: Shell-script question [solved]

2001-02-11 Thread Andre Berger
On 2001-02-11 14:26 +0100, Andre Berger <[EMAIL PROTECTED]> wrote: > I wrote a shell script "/usr/local/bin/mailcheck" (/usr/local/bin/ is in > $PATH of my potato bash) that gives a list of pon "targets" (diff. > ISPs), and is owned by root., perms 755. I've virtually no experience > with shell scr

Re: Shell-script question

2001-02-11 Thread Erdmut Pfeifer
On Sun, Feb 11, 2001 at 03:42:15PM +0100, Andre Berger wrote: > On 2001-02-11 15:16 +0100, Erdmut Pfeifer <[EMAIL PROTECTED]> wrote: > > On Sun, Feb 11, 2001 at 02:26:51PM +0100, Andre Berger wrote: > > > I wrote a shell script "/usr/local/bin/mailcheck" (/usr/local/bin/ is in > > > $PATH of my pot

Re: Shell-script question

2001-02-11 Thread ktb
On Sun, Feb 11, 2001 at 05:03:56PM +0100, Andre Berger wrote: > On 2001-02-11 16:48 +0100, ktb <[EMAIL PROTECTED]> wrote: > > On Sun, Feb 11, 2001 at 03:42:15PM +0100, Andre Berger wrote: > > > On 2001-02-11 15:16 +0100, Erdmut Pfeifer <[EMAIL PROTECTED]> wrote: > > > > On Sun, Feb 11, 2001 at 02:2

Re: Shell-script question

2001-02-11 Thread Andre Berger
On 2001-02-11 16:48 +0100, ktb <[EMAIL PROTECTED]> wrote: > On Sun, Feb 11, 2001 at 03:42:15PM +0100, Andre Berger wrote: > > On 2001-02-11 15:16 +0100, Erdmut Pfeifer <[EMAIL PROTECTED]> wrote: > > > On Sun, Feb 11, 2001 at 02:26:51PM +0100, Andre Berger wrote: > > > > I wrote a shell script "/usr

Re: Shell-script question

2001-02-11 Thread ktb
On Sun, Feb 11, 2001 at 03:42:15PM +0100, Andre Berger wrote: > On 2001-02-11 15:16 +0100, Erdmut Pfeifer <[EMAIL PROTECTED]> wrote: > > On Sun, Feb 11, 2001 at 02:26:51PM +0100, Andre Berger wrote: > > > I wrote a shell script "/usr/local/bin/mailcheck" (/usr/local/bin/ is in > > > $PATH of my pot

Re: Shell-script question

2001-02-11 Thread Andre Berger
On 2001-02-11 15:16 +0100, Erdmut Pfeifer <[EMAIL PROTECTED]> wrote: > On Sun, Feb 11, 2001 at 02:26:51PM +0100, Andre Berger wrote: > > I wrote a shell script "/usr/local/bin/mailcheck" (/usr/local/bin/ is in > > $PATH of my potato bash) that gives a list of pon "targets" (diff. > > ISPs), and is

Re: Shell-script question

2001-02-11 Thread Erdmut Pfeifer
On Sun, Feb 11, 2001 at 02:26:51PM +0100, Andre Berger wrote: > I wrote a shell script "/usr/local/bin/mailcheck" (/usr/local/bin/ is in > $PATH of my potato bash) that gives a list of pon "targets" (diff. > ISPs), and is owned by root., perms 755. I've virtually no experience > with shell scriptin

Re: shell script question

2000-07-16 Thread Chris Majewski
Wow, this looks just like sed(1). Sed rules! chris > > Hi, > perl rules:) > > rename 's/([A-Z])/_\l$1/g' * > > will do the job. > > As I already pointed out on this list, rename cames with the standard > perl package of potato. > > By the way, > rename 's/([A-Z])/_\l$1/g;s/^_([a-z])/\u$1/

Re: shell script question

2000-07-16 Thread Frodo Baggins
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hans scripsit: >So basically my question is 'how to translate one character into two and >vice versa?' Anyone? Thanks for the input. I forgot... to get the reverse transformation _file_name -> FileName simply use rename 's/_([a-z])\u$1/g' * - -- T

Re: shell script question

2000-07-16 Thread Frodo Baggins
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hans scripsit: >Sorry, I'm full of questions today. > >I'm working on a script that can rename filenames. For now I want it to add >an underscore before each capital letter there is in the filename and make >the capital letter lowercase: e.g. FileName