Feed aggregator
Representative Line: The Batch Managing Batch File
Carl was debugging a job management script. The first thing that caught his attention was that the script was called file.bat. They were running on Linux.
The second thing he noticed, was that the script was designed to manage up to 999 jobs, and needed to simply roll job count over once it exceeded 999- that is to say, job 1 comes after job 999.
Despite being called file.bat, it was in fact a Bash script, and thus did have access to the basic mathematical operations bash supports. So while this could have been done via some pretty basic arithmetic in Bash, doing entirely in Bash would have meant not using Awk. And if you know how to use Awk, why would you use anything but Awk?
njobno=`echo $jobno | awk '{if ($0<999) {print $0 + 1} else { print 1 }}'`As Carl writes: "I don't mind the desire to limit job count by way of mod(1000) but what an implementation!"
[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.Windows 11 Update Breaks Recovery Environment, Making USB Keyboards and Mice Unusable
Read more of this story at Slashdot.
Was the Web More Creative and Human 20 Years Ago?
Read more of this story at Slashdot.
A Plan for Improving JavaScript's Trustworthiness on the Web
Read more of this story at Slashdot.
Should Workers Start Learning to Work With AI?
Read more of this story at Slashdot.
To Fight Business 'Enshittification', Cory Doctorow Urges Tech Workers: Join Unions
Read more of this story at Slashdot.
GIMP Now Offers an Official Snap Package For Linux Users
Read more of this story at Slashdot.
Desperate to Stop Waymo's Dead-End Detours, a San Francisco Resident Tried an Orange Cone with a Sign
Read more of this story at Slashdot.
Sony Applies to Establish National Crypto Bank, Issue Stablecoin for US Dollar
Read more of this story at Slashdot.
Why Signal's Post-Quantum Makeover Is An Amazing Engineering Achievement
Read more of this story at Slashdot.
Are Supershear Earthquakes Even More Dangerous Than We Thought?
Read more of this story at Slashdot.
FSF Reminds Consumers That Truly Free OS's Exist
Read more of this story at Slashdot.
Extortion and Ransomware Drive Over Half of Cyberattacks — Sometimes Using AI, Microsoft Finds
Read more of this story at Slashdot.
New Data Shows Record CO2 Levels in 2024. Are Carbon Sinks Failing?
Read more of this story at Slashdot.
OpenAI Cofounder Builds New Open Source LLM 'Nanochat' - and Doesn't Use Vibe Coding
Read more of this story at Slashdot.
Repair Plan Underway to Restore Power at Ukrainian Nuclear Plant
Read more of this story at Slashdot.
Protein Powders and Shakes Contain High Levels of Lead
Read more of this story at Slashdot.
You Only Need $750 to Pilfer Unencrypted Data From Satellites, Researchers Say
Read more of this story at Slashdot.
Should Scientists Be Allowed to Edit Genes of Wild Animals? Top Conservation Groups Just Voted Yes
Read more of this story at Slashdot.
Windows 10 Refugees Flock To Linux as Zorin OS Claims 'Biggest Launch Ever'
Read more of this story at Slashdot.
