bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Quotes problem ?


From: Markos
Subject: Quotes problem ?
Date: Wed, 10 Jan 2007 04:49:12 -0800 (PST)

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_number"p"' /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_number"p" /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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]