Karl Vogel wrote:
> for file in $(ls $MAGDIR/*.[Zz][Ii][Pp] 2> /dev/null); do ...
mkdir $MAGDIR/silly.zip
touch $MAGDIR/silly.zip/not-a-zip-file
If you're going to insist on using "ls" you should consider "ls -d".
Personally, I'd still go for this construct:
for FILE in "$MAGDIR"/*.[
On Thursday 29 July 2010 05:27:35 Mart Frauenlob wrote:
> On 29.07.2010 07:17, Boyd Stephen Smith Jr. wrote:
> > On Wednesday 28 July 2010 21:37:44 Karl Vogel wrote:
> >> I need to think before posting. I didn't mention that I have
> >> FreeBSD, Linux, and Solaris boxes, and unfortunately
On 29.07.2010 07:17, Boyd Stephen Smith Jr. wrote:
On Wednesday 28 July 2010 21:37:44 Karl Vogel wrote:
On Thu, 29 Jul 2010 01:04:27 -,
Cameron Hutchison said:
C> find $MAGDIR -iname '*.zip' -print0 | xargs -0 some-command
C> -iname matches names case insensitively. Since you then
On Wednesday 28 July 2010 21:37:44 Karl Vogel wrote:
> >> On Thu, 29 Jul 2010 01:04:27 -,
>
> >> Cameron Hutchison said:
> C>find $MAGDIR -iname '*.zip' -print0 | xargs -0 some-command
> C> -iname matches names case insensitively. Since you then dont need grep,
> C> you also dont need tr0
On Wednesday 28 July 2010 13:05:22 Karl Vogel wrote:
> >> On 28.07.2010 14:42, Jochen Schulz wrote:
> J> I think you meant to write
> J> for MAGFILE in `ls $MAGDIR/*.[Zz][Ii][Pp]`
> J> Another hint: you don't need 'ls' for your case at all.
>
>I'd recommend keeping the "ls".
Then, you wou
>> On Thu, 29 Jul 2010 01:04:27 -,
>> Cameron Hutchison said:
C>find $MAGDIR -iname '*.zip' -print0 | xargs -0 some-command
C> -iname matches names case insensitively. Since you then dont need grep,
C> you also dont need tr0.
I need to think before posting. I didn't mention that I h
vogelke+deb...@pobox.com (Karl Vogel) writes:
>>> On Wed, 28 Jul 2010 23:58:11 +0200,
>>> Mart Frauenlob said:
>M> One might be better of with some like this:
>M> find /DIR -regextype posix-egrep -regex '.*\.(zip|ZIP)' -exec \
>M> some_command {} +
> If the filelist is potentially too
>> On Wed, 28 Jul 2010 23:58:11 +0200,
>> Mart Frauenlob said:
M> One might be better of with some like this:
M> find /DIR -regextype posix-egrep -regex '.*\.(zip|ZIP)' -exec \
M> some_command {} +
If the filelist is potentially too big for the max argument list on the
system, I wou
On 28.07.2010 20:05, Karl Vogel wrote:
On 28.07.2010 14:42, Jochen Schulz wrote:
J> I think you meant to write
J> for MAGFILE in `ls $MAGDIR/*.[Zz][Ii][Pp]`
J> Another hint: you don't need 'ls' for your case at all.
I'd recommend keeping the "ls". Try your script when MAGDIR doesn'
>> On 28.07.2010 14:42, Jochen Schulz wrote:
J> I think you meant to write
J> for MAGFILE in `ls $MAGDIR/*.[Zz][Ii][Pp]`
J> Another hint: you don't need 'ls' for your case at all.
I'd recommend keeping the "ls". Try your script when MAGDIR doesn't
have any zipfiles, and MAGFILE will ho
> for MAGFILE in $MAGDIR/*.zip
Don't forget the double quotes around variable references. It's better
to always do that by default than to fix it afterwards (either because
you feed it paths with whitespace in them yourself at some point or
because someone else is trying to close the safety holes
> for MAGFILE in `ls *.[Zz][Ii][Pp] $MAGDIR/`; do
> #lots of other stuff
> done
As others noted, the ls command is superfluous and possibly harmful
here.
One more thing you can do is case-insensitive pathname expansion:
shopt -s nocaseglob
for MAGFILE in $MAGDIR/*.zip
do
#lots of other
On 20100728_082732, Martin McCormick wrote:
> Cesar Garcia writes:
> > Perhaps, try with this:
> >
> > for MAGFILE in `ls $MAGDIR/*.[Zz][Ii][Pp]`; do
It probably doesn't really matter in practice, but this will
pick up also files that match $MAGDIR/*.zIp , etc. (mixed case)
To avoid getting the
On 28.07.2010 14:42, Jochen Schulz wrote:
Martin McCormick:
ls *.[Zz][Ii][Pp]
Note that 'ls' doesn't see this pattern at all. The pattern is expanded
by the shell to all existing files matching the pattern. This list of
files is then passed to ls. Using 'echo' would yield (almost) the same
re
Cesar Garcia writes:
> Perhaps, try with this:
>
> for MAGFILE in `ls $MAGDIR/*.[Zz][Ii][Pp]`; do
That worked. Thank you.
As soon as I saw the example, I realized that in the
script, there was no way for it to know where these files were
that I was looking for. Also my thanks to
Martin McCormick:
>
> ls *.[Zz][Ii][Pp]
Note that 'ls' doesn't see this pattern at all. The pattern is expanded
by the shell to all existing files matching the pattern. This list of
files is then passed to ls. Using 'echo' would yield (almost) the same
result in this case.
> for MAGFILE in
On 7/28/10 7:06 AM, Jordon Bedwell wrote:
#!/bin/sh
for MAGFILE in $(ls *\.[zZ][iI][pP])
do
echo "File: $MAGFILE";
done
I would prefer to rely on $() before `` in a bash script.
Sorry, I did that script on OS X, you should switch the SH shebang to
Bash, it's just aliased on OS X but not on
On 7/28/10 6:33 AM, Martin McCormick wrote:
I could have sworn I have done this before but obviously
not because I can't get it to work no matter what I try.
I am running a shell script that is supposed to find
every .zip or .ZIP file in a directory and do an extraction of
the co
Perhaps, try with this:
for MAGFILE in `ls $MAGDIR/*.[Zz][Ii][Pp]`; do
El 28/07/10 13:33, Martin McCormick escribió:
> I could have sworn I have done this before but obviously
> not because I can't get it to work no matter what I try.
>
> I am running a shell script that is suppos
I could have sworn I have done this before but obviously
not because I can't get it to work no matter what I try.
I am running a shell script that is supposed to find
every .zip or .ZIP file in a directory and do an extraction of
the contents. I don't want any other files to be inc
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
>
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
Kevin,
Looking for a solution to *my* problem (strange networking problem with debian
testing), I saw your post and thought I'd respond.
> # set some variables to nightmarish values for testing purposes
> d='"ab\""q"' # literal value is "ab\""q"
> e='$d' # literal v
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
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
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
Hi,
What I want is this: I have a file in which a list of files or directories are present, like below (let's name this file input_file):
/mnt/hda6/File1
/mnt/hda5/Directory1
/mnt/hda6/File2
/mnt/hda6/File3
/mnt/hda6/Directory2
...
In a shell script I want to read this file line by line an
I wrote:
> Could someone tell me why the following works in zsh but not in
> bash/posh/dash?
>
> benjo[3]:~% echo foo bar baz | read a b c
> benjo[4]:~% echo $a $b $c
> foo bar baz
Thanks everyone for the enlightening answers! So just to summarize, the
problem is that the pipeline is treated a
On Thu, Mar 02, 2006 at 10:23:20AM -0500, Kevin B. McCarty wrote:
> Hi list,
>
> Could someone tell me why the following works in zsh but not in
> bash/posh/dash?
>
> benjo[3]:~% echo foo bar baz | read a b c
> benjo[4]:~% echo $a $b $c
> foo bar baz
>
> If I try the same with bash (or other sh-
On Thursday 02 March 2006 16:23, Kevin B. McCarty wrote:
> Hi list,
>
> Could someone tell me why the following works in zsh but not in
> bash/posh/dash?
>
> benjo[3]:~% echo foo bar baz | read a b c
> benjo[4]:~% echo $a $b $c
> foo bar baz
>
> If I try the same with bash (or other sh-compatible s
On Thu, Mar 02, 2006 at 10:23:20AM -0500, Kevin B. McCarty wrote:
> Hi list,
>
> Could someone tell me why the following works in zsh but not in
> bash/posh/dash?
>
> benjo[3]:~% echo foo bar baz | read a b c
> benjo[4]:~% echo $a $b $c
> foo bar baz
>
> If I try the same with bash (or other sh-
On Thu, Mar 02, 2006 at 09:19:02AM -0800, David Kirchner wrote:
> On 3/2/06, Kevin B. McCarty <[EMAIL PROTECTED]> wrote:
> > Hi list,
> >
> > Could someone tell me why the following works in zsh but not in
> > bash/posh/dash?
> >
> > benjo[3]:~% echo foo bar baz | read a b c
> > benjo[4]:~% echo $a
Hi, Kevin.
I don't have a solution, but I found that interesting,
so did some experiments:
$ bash --version
bash --version
GNU bash, version 3.1.0(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
$ echo foo | read a; echo $a
returns empty variable
a whole lot of
On 3/2/06, Kevin B. McCarty <[EMAIL PROTECTED]> wrote:
> Hi list,
>
> Could someone tell me why the following works in zsh but not in
> bash/posh/dash?
>
> benjo[3]:~% echo foo bar baz | read a b c
> benjo[4]:~% echo $a $b $c
> foo bar baz
>
> If I try the same with bash (or other sh-compatible she
Hi list,
Could someone tell me why the following works in zsh but not in
bash/posh/dash?
benjo[3]:~% echo foo bar baz | read a b c
benjo[4]:~% echo $a $b $c
foo bar baz
If I try the same with bash (or other sh-compatible shells), the
variables $a $b and $c are unset. From the bash man page:
>
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
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
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
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
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 file at a time to prevent using too much
of their bandwi
> 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
"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
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,
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 parent shell to a different
parent shell? I know
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
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
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
>
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
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
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
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
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
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
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
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 me the error "too many args in line four."
How can I fix this?
Thanks,
Jeff Elk
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
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
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
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
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
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
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
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
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 scripting, so it may be poor quality. Anyway: If the script
is invoked from a
Trying to use a couple of different .muttrc configurations, they need
to use a shell script to find different mailboxes, execute the mail
program, etc.. I download and save them to my user directory. When I
execute the mail command, I get a 'permission denied' at the
prompt. I'm pretty sure this is
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/
-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
-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
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 --> _file_name.
I tried many things like:
for a in *; do mv $a `
69 matches
Mail list logo