Cmd Batch Files Running Without Finishing: Recursion problem??

mavigozler

New member
Local time
9:48 PM
Messages
22
I have a very simple batch set in a file called sed.cmd.

Code:
set input="D:\WebServerConfig\httpd\logs\old logs\webserver-access.log"
set output="D:\WebServerConfig\httpd\logs\old logs\webserver-access-trimmed.log"
set script=D:\WebServerConfig\httpd\logs\delete-needless-webserver-access-log-lines.sed
sed -r -u -f %script% %input% >%output
It just runs without exiting.

When I don't re-direct output, meaning output goes to stdout (the command window), meaning I just have the edited cmd file as:

Code:
set input="D:\WebServerConfig\httpd\logs\old logs\webserver-access.log"
set output="D:\WebServerConfig\httpd\logs\old logs\webserver-access-trimmed.log"
set script=D:\WebServerConfig\httpd\logs\delete-needless-webserver-access-log-lines.sed
sed -r -u -f %script% %input%
It runs without exiting, but now I can see what is happening through the standard output: I just see each of the batch command lines output in a never-ending continuing cycle.

When I try to terminate with Ctrl-C, I keep seeing "Terminate batch job (Y/N)?" as I continue to enter "Y". When I close the cmd window forciby, I see a whole bunch of ^C characters output before the window is closed, suggesting some sort of recursion was happening...but why?
 

My Computer

Computer Manufacturer/Model Number
ASUS G74SX-BBK11
OS
Windows 7 Home Premium 64-bit
CPU
Intel Core i7 2670QM @ 2.2 GHz
Motherboard
ASUS
Memory
8 GB
Graphics Card(s)
nVIDIA GTX560M
Sound Card
nVIDIA HDA, Realtek HDA
Screen Resolution
1650 x 1080
Hard Drives
Seagate 1 TB @ 5400 rpm (ST1000LM024)
PSU
notebook
Case
notebook
Cooling
Internal + Thermaltake platform
Keyboard
notebook
Mouse
Synaptics PS/2 Port Touchpad
Internet Speed
4 Mbps down, 800 Kbps up
Other Info
Perfect description of rig: http://basic-electronics.blogspot.com/2012/03/asus-g74sx-bbk11-173-inch-core-i7.html
you named the batch file SED and then you call SED from within the batch file...

it is calling itself over and over
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
you named the batch file SED and then you call SED from within the batch file...

it is calling itself over and over

LOL!

Okay. yes

I changed to the last line in the batch file to

sed.exe -r -u ...

and problem solved.

Pretty rookie mistake.
 

My Computer

Computer Manufacturer/Model Number
ASUS G74SX-BBK11
OS
Windows 7 Home Premium 64-bit
CPU
Intel Core i7 2670QM @ 2.2 GHz
Motherboard
ASUS
Memory
8 GB
Graphics Card(s)
nVIDIA GTX560M
Sound Card
nVIDIA HDA, Realtek HDA
Screen Resolution
1650 x 1080
Hard Drives
Seagate 1 TB @ 5400 rpm (ST1000LM024)
PSU
notebook
Case
notebook
Cooling
Internal + Thermaltake platform
Keyboard
notebook
Mouse
Synaptics PS/2 Port Touchpad
Internet Speed
4 Mbps down, 800 Kbps up
Other Info
Perfect description of rig: http://basic-electronics.blogspot.com/2012/03/asus-g74sx-bbk11-173-inch-core-i7.html
:-)
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Back
Top