Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Oct 21st, 2006, 12:44 PM   #1
iradic
Programmer
 
Join Date: Feb 2006
Posts: 36
Rep Power: 0 iradic is on a distinguished road
Bash scirpt help (msys)?

I wrote a script to generate makefiles...

And it works but not always

Here is some info output...

This shouldn't happen:
$ mage.sh -u *.c > Makefile 
Makefile -> /tmp/.mage.sh.432.mak
1
new file: dlist.c
1
new file: filter.c
1
new file: getaline.c
1
new file: hash.c
1
new file: main.c
1
new file: memdbg.c
1
new file: parser.c

This is ok:
$ mage.sh -u *.c            
Makefile -> /tmp/.mage.sh.1120.mak
0
old file: dlist.c
0
old file: filter.c
0
old file: getaline.c
0
old file: hash.c
0
old file: main.c
0
old file: memdbg.c
0
old file: parser.c

And this is the guilty part of script (I think):
UpdateNew () {
    # updates include only cc stuff
    for file in $(echo "$1" | sed 's/:/ /g') ; do
	if [ ! -r "$file" ]; then
		Warn "Could not open - '$file'"
		continue
	fi
	if $(grep -q '^'${file%.*}'[$](OBJ):' "${tmp}.mak"); then
	  echo $? 1>&2
	  Notify "old file: $file"
	  old="$old$file:"
	else
	  echo $? 1>&2
	  Notify "new file: $file"
	  new="$new$file:"
	fi
    done
    MkDepend "$old"
    EmitCC "$new"
}

Note that script works when not redirecting???
How should I fix this?

Thanks

Ooops, I just noticed that when not redirecting to Makefile (which is copied in the first place) everything works... Anyway can I fix this behavior?
iradic is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I call a bash script in C? smile_sunshine C 8 Apr 30th, 2006 9:36 PM
Bash or Perl? titaniumdecoy Other Scripting Languages 9 Jan 30th, 2006 4:42 PM
Do you use perl over bash scripting? linuxpimp20 Perl 3 Sep 12th, 2005 2:29 PM
Window Re-sizing in bash script. Huck Bash / Shell Scripting 1 May 1st, 2005 5:31 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:48 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC