scripting

Command line script run in background goes in stopped state

时光毁灭记忆、已成空白 提交于 2020-01-01 05:52:06
问题 I have a short php utility script, I run it from cli simply with: php myscript.php The script is always running, periodically performing some tasks (not relevant for the question). It doesn't need any input from the user. After running it, I usually press CTRL + z and then run bg to put the process in background, and everything is fine. If I run it as: php myscript.php & the script is put on background on start, but it is also put in a stopped state. Example: [1] 11513 [1]+ Stopped php

Regex to replace last occurrence of a string in each line

社会主义新天地 提交于 2020-01-01 04:30:08
问题 I am using sed -e 's/\(.*\)ABC/\1DEF/' myfile to replace the last occurrence of ABC with DEF in a file. I want to modify it to replace the last occurrence of ABC with DEF in each line in the file. Is it possible to do with regex ? Thanks 回答1: You need to add 'g' to the end of your sed: sed -e 's/\(.*\)ABC/\1DEF/g' This tells sed to replace every occurrence of your regex ("globally") instead of only the first occurrence. EDIT: You should also add a $ , if you want to ensure that it is

Why embed lua into a game engine?

跟風遠走 提交于 2020-01-01 03:31:09
问题 I've been looking into building a basic game engine from the ground up and after making a list of features that are common to other engines, one of the bigger things is the fact that they have an embedded scripting language like lua or python. My question is how is an embedded scripting language superior to just making a header file (or something of the like) that the user can include in a c++ file which gives them access to many of the functions and states. I'm sure there's a very good

How to run a script after Xcode runs codesign on my iPhone app?

爷,独闯天下 提交于 2020-01-01 02:32:15
问题 I've got a script written which does some steps to package my build for an Ad Hoc distribution. My first guess was to use a run script phase in my Ad Hoc target. But it looks like codesigning is fixed at the last position in the chain of building iPhone apps. Somebody has a clue how can I run my script at the very last possible moment in the build process? Update: Look at this answer below on how to run scripts in Xcode 4. 回答1: Can you create an aggregate target that contains both your "Ad

Ruby sandboxing vs. integrating a scripting language

本小妞迷上赌 提交于 2019-12-31 21:46:07
问题 I am currently working on a text-based game engine in Ruby, with the app separated into Ruby code in /lib and YAML data in /data, which is loaded when needed by the game. I want to allow the data files to contain basic scripts, mostly in an event/observer model. However, I also want users to be able to generate and share custom scenarios without having to worry about malicious code embedded in the script. Addendum: My original plan was to have user-created content separated into two types,

How to specify the current directory in Windows Shell?

半腔热情 提交于 2019-12-31 19:50:19
问题 I have the following BAT file which is intended to archive the specified folder, protect it by a password and copy the archive file to my local Dropbox folder. "C:\Program Files\7-Zip\7z.exe" a -mx9 archive.7z "G:\This is a test\directory\with subdirectories\" -psecret -mhe=on xcopy "G:\This is a test\directory\with subdirectories\archive.7z" "G:\My Documents\My Dropbox\" /c /d /s /e /k /y I use 7-Zip for archiving. Is it possible to alter the script in such a way that I can put it in any

How to specify the current directory in Windows Shell?

寵の児 提交于 2019-12-31 19:50:10
问题 I have the following BAT file which is intended to archive the specified folder, protect it by a password and copy the archive file to my local Dropbox folder. "C:\Program Files\7-Zip\7z.exe" a -mx9 archive.7z "G:\This is a test\directory\with subdirectories\" -psecret -mhe=on xcopy "G:\This is a test\directory\with subdirectories\archive.7z" "G:\My Documents\My Dropbox\" /c /d /s /e /k /y I use 7-Zip for archiving. Is it possible to alter the script in such a way that I can put it in any

Can a PHP script start another PHP script and exit?

ε祈祈猫儿з 提交于 2019-12-31 16:31:41
问题 How can a PHP script start another PHP script, and then exit, leaving the other script running? Also, is there any way for the 2nd script to inform the PHP script when it reaches a particular line? 回答1: Here's how to do it. You tell the browser to read in the first N characters of output and then close the connection, while your script keeps running until it's done. <?php ob_end_clean(); header("Connection: close"); ignore_user_abort(); // optional ob_start(); echo ('Text the user will see');

Can a PHP script start another PHP script and exit?

旧街凉风 提交于 2019-12-31 16:31:19
问题 How can a PHP script start another PHP script, and then exit, leaving the other script running? Also, is there any way for the 2nd script to inform the PHP script when it reaches a particular line? 回答1: Here's how to do it. You tell the browser to read in the first N characters of output and then close the connection, while your script keeps running until it's done. <?php ob_end_clean(); header("Connection: close"); ignore_user_abort(); // optional ob_start(); echo ('Text the user will see');

Android: How to create a homescreen shortcut to launch a shell script? [closed]

蓝咒 提交于 2019-12-31 14:35:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Are there any apps for creating a home screen shortcut for a shell script (so I will need just to click on it to run the script)? It would be great if the app will be open source, and will allow me to save scripts to the internal storage of a rooted device. 回答1: Answer: The answer to your question should be