Sponsored Content
Top Forums Shell Programming and Scripting My for loop decides to become an infinite loop? Post 302580519 by gotreef on Thursday 8th of December 2011 07:06:43 PM
Old 12-08-2011
Thanks again for the response, it's greatly appreciated. My .par files are located in the same directory as sparbsq and the script. Without getting into the details of what they contain, there are 5 of them listed as:
hyp2modqkm.par, hyp2mod375m.par, hyp2modhkm.par, hyp2mod750m.par, hyp2mod1km.par

I need to run spatbsq on every image file 5 times, each time with a different .par as an input.

Hope hypothetical example v2.0 will be more clear about what I need to do. My files are:
/newyork/brooklynbridge
/newyork/brooklynbridge.hdr

I would run it roughly as follows:
./spatbsq [.par] [input] [output]
./spatbsq hyp2qkm.par /newyork/brooklynbridge /newyork/brooklynbridge.qkm
./spatbsq hyp2375m.par /newyork/brooklynbridge /newyork/brooklynbridge.375m
./spatbsq hyp2hkm.par /newyork/brooklynbridge /newyork/brooklynbridge.hkm
./spatbsq hyp2750m.par /newyork/brooklynbridge /newyork/brooklynbridge.750m
./spatbsq hyp21km.par /newyork/brooklynbridge /newyork/brooklynbridge.1km

so in regards to renaming, all I do is essentially tack on the suffix of the .par to my output file. The cp is because each of these outputs need a .hdr file of the same name. The .hdr is simply spatial information for the photo and since the brooklyn bridge doesn't really shift around, I just copy the original .hdr to one with the appropriate $res suffix.

---------- Post updated at 02:06 PM ---------- Previous update was at 01:29 PM ----------

It looks like your little script snippit solved all my problems plus I feel like I've learned a lot as well, for which I'm greatful.

One quick thing though. When you have the "while read FILE", how does it know that the FILE is the /tmp/$$ file?
 

10 More Discussions You Might Find Interesting

1. Solaris

ls command in infinite Loop

Hi, whenever I am giving a 'ls' command system is going into infinite loop displaying the current home directory. There is no separate shell script/file with ls name anywhere in the system. I am using Solaris 10. Any help / guidance in solving this problem is highly appreciated. ... (3 Replies)
Discussion started by: umakant
3 Replies

2. Shell Programming and Scripting

Infinite loop not looping

Hi guys, I'm having a problem getting my infinite loop to loop. It simply reads in the users choice form the menu, executes the corresponding case statement and quits instead of looping back to the main menu again. I have a feeling it might be something with my if then statements within the case... (2 Replies)
Discussion started by: hootdocta5
2 Replies

3. Programming

Is my code in an Infinite Loop?

Production C code compiled without the dash-g option is running, and seems to be in an infinite loop. Is there a way to tell? Is there a diagnostic tool that will report what objects or what lines of code or even what functions are being executed? Or is my best option to kill it with a dump? ... (5 Replies)
Discussion started by: marcus121
5 Replies

4. Shell Programming and Scripting

infinite while do loop problem

hi all, this is how my scrip looks like #!/bin/sh bindir='/opt/apps/script/bin' datadir='/opt/apps/script/data' dir='/opt/apps/script' while : ; do ls -1rt /opt/apps/script/data/check.txt*|tail -1 > /dev/null 2>&1 if ;then chmod +rwx $bindir/dummy2.sh ... (8 Replies)
Discussion started by: tententen
8 Replies

5. Shell Programming and Scripting

Infinite while loop

what is the difference between while:,while true and while false? (6 Replies)
Discussion started by: proactiveaditya
6 Replies

6. UNIX for Advanced & Expert Users

Procmail and infinite loop

I wanted to copy (not forward but copy) all incoming email to another address of mine. It worked, but now I encountered an infinite loop problem: When the second address doesn't like the content and bounces the message back, the bounce message will be sent back and forth. So, what I have in... (1 Reply)
Discussion started by: distill
1 Replies

7. Shell Programming and Scripting

Call a infinite loop

Hi All, I need to run an infinite loop. requirement below: function1 --> creates a file file1 function2 ---> need to call if the file creates i am running these both function via a script --> script.sh i need to run the function1 first and if the file file1 creates then need to run the... (3 Replies)
Discussion started by: satyaranjon
3 Replies

8. Homework & Coursework Questions

Help with infinite loop problem

1. The problem statement, all variables and given/known data: My problem is an infinite loop when i press any other key other then Y or y in the while loop. what i want it to do is return to the normal script outside of it if pressing N or n or keep asking the same question if its any other... (4 Replies)
Discussion started by: Ren_kun
4 Replies

9. Shell Programming and Scripting

How to stop infinite loop

Im unable to stop the below infinite loop (bash script). Can someone tell me why this isnt responding to signals eg: ctrl+c (SIGINT) or ctrl+z c=0 test_loop() { c=$(($c+1)) echo "count value is : $c " sleep 1 test_loop } Im using: SunOS 5.10 PS: If run this as... (13 Replies)
Discussion started by: Arun_Linux
13 Replies

10. Shell Programming and Scripting

Infinite loop query

I have a script script.shwhich is scheduled to run at 11 AM everyday. # script.sh Code: ./scb_script.sh & unfortunately scb_script.sh is running today in infinite loop as respective files are not available. My question, when script.sh starts running tomorrow, will the old process be... (1 Reply)
Discussion started by: JSKOBS
1 Replies
PAR(1p) 						User Contributed Perl Documentation						   PAR(1p)

NAME
par.pl - Make and run Perl Archives SYNOPSIS
(Please see pp for convenient ways to make self-contained executables, scripts or PAR archives from perl programs.) To make a PAR distribution from a CPAN module distribution: % par.pl -p # make a PAR dist under the current path % par.pl -p Foo-0.01 # assume unpacked CPAN dist in Foo-0.01/ To manipulate a PAR distribution: % par.pl -i Foo-0.01-i386-freebsd-5.8.0.par # install % par.pl -i http://foo.com/Foo-0.01 # auto-appends archname + perlver % par.pl -i cpan://AUTRIJUS/PAR-0.74 # uses CPAN author directory % par.pl -u Foo-0.01-i386-freebsd-5.8.0.par # uninstall % par.pl -s Foo-0.01-i386-freebsd-5.8.0.par # sign % par.pl -v Foo-0.01-i386-freebsd-5.8.0.par # verify To use Hello.pm from ./foo.par: % par.pl -A./foo.par -MHello % par.pl -A./foo -MHello # the .par part is optional Same thing, but search foo.par in the @INC; % par.pl -Ifoo.par -MHello % par.pl -Ifoo -MHello # ditto Run test.pl or script/test.pl from foo.par: % par.pl foo.par test.pl # looks for 'main.pl' by default, # otherwise run 'test.pl' To make a self-containing script containing a PAR file : % par.pl -O./foo.pl foo.par % ./foo.pl test.pl # same as above To embed the necessary non-core modules and shared objects for PAR's execution (like "Zlib", "IO", "Cwd", etc), use the -b flag: % par.pl -b -O./foo.pl foo.par % ./foo.pl test.pl # runs anywhere with core modules installed If you also wish to embed core modules along, use the -B flag instead: % par.pl -B -O./foo.pl foo.par % ./foo.pl test.pl # runs anywhere with the perl interpreter This is particularly useful when making stand-alone binary executables; see pp for details. DESCRIPTION
This stand-alone command offers roughly the same feature as "perl -MPAR", except that it takes the pre-loaded .par files via "-Afoo.par" instead of "-MPAR=foo.par". Additionally, it lets you convert a CPAN distribution to a PAR distribution, as well as manipulate such distributions. For more information about PAR distributions, see PAR::Dist. Binary PAR loader (parl) If you have a C compiler, or a pre-built binary package of PAR is available for your platform, a binary version of par.pl will also be automatically installed as parl. You can use it to run .par files: # runs script/run.pl in archive, uses its lib/* as libraries % parl myapp.par run.pl # runs run.pl or script/run.pl in myapp.par % parl otherapp.pl # also runs normal perl scripts However, if the .par archive contains either main.pl or script/main.pl, it is used instead: % parl myapp.par run.pl # runs main.pl, with 'run.pl' as @ARGV Finally, the "-O" option makes a stand-alone binary executable from a PAR file: % parl -B -Omyapp myapp.par % ./myapp # run it anywhere without perl binaries With the "--par-options" flag, generated binaries can act as "parl" to pack new binaries: % ./myapp --par-options -Omyap2 myapp.par # identical to ./myapp % ./myapp --par-options -Omyap3 myap3.par # now with different PAR Stand-alone executable format The format for the stand-alone executable is simply concatenating the following elements: o The executable itself Either in plain-text (par.pl) or native executable format (parl or parl.exe). o Any number of embedded files These are typically used for bootstrapping PAR's various XS dependencies. Each section contains: The magic string ""FILE"" Length of file name in "pack('N')" format plus 9 8 bytes of hex-encoded CRC32 of file content A single slash (""/"") The file name (without path) File length in "pack('N')" format The file's content (not compressed) o One PAR file This is just a zip file beginning with the magic string ""PK0304"". o Ending section The pre-computed cache name. A pack('Z40') string of the value of -T (--tempcache) or the hash of the file, followed by "CACHE". The hash of the file is calculated with Digest::SHA, Digest::SHA1, or Digest::MD5. If none of those modules is available, the "mtime" of the file is used. A pack('N') number of the total length of FILE and PAR sections, followed by a 8-bytes magic string: ""12PAR.pm12"". SEE ALSO
PAR, PAR::Dist, parl, pp AUTHORS
Audrey Tang <cpan@audreyt.org>, Steffen Mueller <smueller@cpan.org> <http://par.perl.org/> is the official PAR website. You can write to the mailing list at <par@perl.org>, or send an empty mail to <par-subscribe@perl.org> to participate in the discussion. Please submit bug reports to <bug-par@rt.cpan.org>. COPYRIGHT
Copyright 2002-2009 by Audrey Tang <cpan@audreyt.org>. Neither this program nor the associated parl program impose any licensing restrictions on files generated by their execution, in accordance with the 8th article of the Artistic License: "Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package." Therefore, you are absolutely free to place any license on the resulting executable, as long as the packed 3rd-party libraries are also available under the Artistic License. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> perl v5.14.2 2011-03-22 PAR(1p)
All times are GMT -4. The time now is 07:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy