On Wed, May 19, 2004 at 08:11:35AM -0500, Michael Martinell wrote:
} Hopefully somebody here has perhaps seen this oddity and can provide some
} insight into the cause.
}
} I have a very simple shell script as follows:
} mail:~/scripts# more topcheck
} #!/bin/bash
} date > /usr/local/apache/htdocs
Craig Dickson wrote:
> john wrote:
>
> > Sunny Dubey wrote:
> >
> > > Hey,
> > >
> > > how come the followind doesn't seem to work ...
> > >
> > > for i in `ls -1 /some/dir` ; do
> > > cat /some/dir/"$i" >> /usr/fruits.txt
> > > done
> > >
> >
> > because $i contains lines like:
> > dr
john wrote:
> Sunny Dubey wrote:
>
> > Hey,
> >
> > how come the followind doesn't seem to work ...
> >
> > for i in `ls -1 /some/dir` ; do
> > cat /some/dir/"$i" >> /usr/fruits.txt
> > done
> >
>
> because $i contains lines like:
> drw-r--r--2 sunnysunny12345 Oct 23
Sunny Dubey wrote:
> how come the followind doesn't seem to work ...
>
> for i in `ls -1 /some/dir` ; do
> cat /some/dir/"$i" >> /usr/fruits.txt
> done
>
> cat just gives me the odd error of files not being found, however, I can't
> see why the files wouldn't be found ... hrrm ...
>
> th
Apparently, on Mon, Nov 05, 2001 at 09:04:38PM -0500, Sunny Dubey wrote:
> Hey,
>
> how come the followind doesn't seem to work ...
>
>
> for i in `ls -1 /some/dir` ; do
> cat /some/dir/"$i" >> /usr/fruits.txt
> done
>
> cat just gives me the odd error of files not being found, however, I
--- Sunny Dubey <[EMAIL PROTECTED]> wrote: > Hey,
>
> how come the followind doesn't seem to work ...
>
>
> for i in `ls -1 /some/dir` ; do
> cat /some/dir/"$i" >> /usr/fruits.txt
> done
the problem is with -l switch
>
> cat just gives me the odd error of files not being
> found,
Hi Sunny!
Sunny Dubey wrote:
> Hey,
>
> how come the followind doesn't seem to work ...
>
> for i in `ls -1 /some/dir` ; do
> cat /some/dir/"$i" >> /usr/fruits.txt
> done
>
because $i contains lines like:
drw-r--r--2 sunnysunny12345 Oct 23 14:09 hello.c
which is very
You can do basic script debugging with -x, as in:
sh -x myscript
Or use set -v in the script, as in:
set -v
for i in...
cat ...
done
set +v
~mark
- Original Message -
From: "Sunny Dubey" <[EMAIL PROTECTED]>
To:
Sent: Monday, November 05, 2001 6:04 PM
Subject: She
> Use another loop:
>
> for $fruit in `cat fruits`; do
> while [ -z $ANS ]; do
> echo -n "Do you like $fruit"
> read ANS
> done
> done
hey, thanks for the code above :)
It works, I just needed to add a unset ANS above the while [ blah blah ] line
thanks
S
On Tue, Oct 30, 2001 at 06:48:42PM -0500, Sunny Dubey wrote:
> for $fruit in `cat /usr/fruits.txt` ;
> do
> echo -n "Do you like $fruit"
> read ANS
> if [ -z $ANS ] ; then
> # NEED HELP WITH CODE HERE
> fi
> done
>
On Tue, Oct 30, 2001 at 06:48:42PM -0500, Sunny Dubey wrote:
> for $fruit in `cat /usr/fruits.txt` ;
> do
> echo -n "Do you like $fruit"
> read ANS
> if [ -z $ANS ] ; then
> # NEED HELP WITH CODE HERE
> fi
> done
>
On Sat, Oct 27, 2001 at 06:10:35PM -0400, Sunny Dubey wrote:
> my question is, how do I get it to print the list with each line as the
> variable $fruit, as opposed to $fruit being each word.
Set the IFS variable to exclude spaces. (Normally it contains a space, a
tab, and a newline.) $IFS contro
Hi, (I am not programmer)
On Sat, Oct 27, 2001 at 06:10:35PM -0400, Sunny Dubey wrote:
> I have a file which as a list of varions itmes (example below)
>
> # /usr/food/fruits.txt
> banana medium yellow
> apple small red
> watermelon big green
> plum small red
> etc etc etc ...
>
> when I create
Hello,
I believe something like this should work:
for $fruit in 'cat /usr/food/fruits.txt' &&
do echo -n $fruit
done
echo -n omits the trailing newline as seen in 'man echo'
Enjoy,
Cameron Matheson
On Sat, Oct 27, 2001 at 06:10:35PM -0400, Sunny Dubey wrote:
> I have a file which as a
on Sat, Oct 27, 2001 at 06:10:35PM -0400, Sunny Dubey ([EMAIL PROTECTED]) wrote:
> (sorry if this got send to the list twice)
>
> Hi,
>
> I have a file which as a list of varions itmes (example below)
>
> # /usr/food/fruits.txt
> banana medium yellow
> apple small red
> watermelon big green
> pl
15 matches
Mail list logo