Re: Quotes problem ?

2007-01-11 Thread Markos

Hello , 

Eric: Sorry, I forgot to mention the platform. It is a Sun 250 with Solaris
8.Thank you anyway.

Paul: It worked with the changes you told me. Thank you very much.I still
have a question anyway:
You said that line 
cd $path 
should be better with quotes to avoid problems with dir names containing
spaces, so did you mean this?
cd $path


-- 
View this message in context: 
http://www.nabble.com/Quotes-problem---tf2952284.html#a8275269
Sent from the Gnu - Bash mailing list archive at Nabble.com.



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Quotes problem ?

2007-01-10 Thread Markos

Hello , 
I'm having problems with the script I send below.

Problem description:

I'm trying to run a script called logo_changer.sh that creates a file called
results containing different lines 
and every line is a path to a dir where the logo_1.gif file is located.
After the 
results file is filled, I try to read it line by line, go to every dir
refered in that line,
check the size of the logo_1.gif file in that dir and then store both path
and size of every 
logo_1.gif file founded on the system in a file called report.

I run bash -x logo_changer.gif and the result is this:
...
[cut some lines here with same message]
...
+ sed -n '$line_numberp' /tmp/results
/tmp/logo_changer.sh: : No such file or directory
+ cd
+ pwd
+ ls -go logo_1.gif
logo_1.gif: No such file or directory
+ awk '{print $3}' /tmp/size
+ echo
+ line_number=line_number+1
+ i=6
+ '[' 6 -le 5 ']'

can anybody reproduce the problem and tell me what is wrong?



#!/usr/local/bin/bash
#Execute it from /ecas

#We search for the string logo_1.gif and store the resulting paths in
results_1

find . -name logo_1.gif /tmp/results_1

#Delete logo_1.gif string from every line in results_1,
#leaving only the path to prepare for cd step

sed 's/logo_1.gif//' /tmp/results_1 /tmp/results

#Initialization of variables
i=1
line_number=1 #every line (dir path) stored in results
path=

while [ $i -le 5 ]#In fact it contains more than 5 of course...
do

#Start taking line by line and store it the path variable

sed -n $line_numberp /tmp/results $path

#We change to dir stored in the path variable

cd $path

#Print actual path into /tmp/report to check later

pwd /tmp/report

#Take the size of logo_1.gif file from current dir

ls -go logo_1.gif /tmp/size

#Print actual file size into /tmp/report to check later

awk '{print $3}' /tmp/size /tmp/report

#Print a blank line at the report after every path and size to see things
clearer

echo /tmp/report

#Update variables 

line_number=line_number+1
i=$[$i+1]

done
-- 
View this message in context: 
http://www.nabble.com/Quotes-problem---tf2952284.html#a8256981
Sent from the Gnu - Bash mailing list archive at Nabble.com.



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash