scripting

echo newline suppression [duplicate]

怎甘沉沦 提交于 2019-12-22 04:44:19
问题 This question already has answers here : 'echo' without newline in a shell script (8 answers) Closed 2 years ago . Why doesn't $echo '-n' write -n on terminal although -n is written within single quotes ? 回答1: Because the quotes are processed by the shell and the echo command receives plain -n . If you want to echo -n , you can e.g. printf '%s\n' -n 回答2: you should try to use the more portable printf as far as possible. 回答3: You could try echo -e '\055n' 回答4: I found that the following just

What scripting tool can I use for automated testing of Delphi programs? [closed]

試著忘記壹切 提交于 2019-12-22 04:13:12
问题 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 . I'm looking for a tool for automated testing. I will use scripting for testing, rather than just automating, which means that it can't just send some key-presses. It needs to examine the app's window to see if it was updated correctly. The cheaper the better, with no downside limit on cost. ;-) I need a real

Can a Ruby script tell what directory it’s in?

倖福魔咒の 提交于 2019-12-22 01:55:14
问题 Inspired by "Getting the source directory of a Bash script from within", what's the Ruby way to do this? 回答1: For older versions of Ruby (< 2.0), the script being run can be found using: File.dirname(__FILE__) - relative path; or File.expand_path(File.dirname(__FILE__)) - the absolute path. For newer versions of Ruby, try: __dir__ Using __dir__ will return the script path even after a call to Dir.chdir ; whereas, using the older syntax may not return the path to the script. 回答2: Use __dir__

Getting the Process ID of another program in Groovy using 'command slinging'

瘦欲@ 提交于 2019-12-22 01:08:02
问题 import java.lang.management.* final String name = ManagementFactory.getRuntimeMXBean().getName(); final Integer pid = Integer.parseInt(name[0..name.indexOf("@")-1]) I tried this in my code but that gets the pid of the running program. I am running a sleeping script (all it does is sleep) called sleep.sh and i want to get the pid of that. Is there a way to do that? I have not found a very good way myself. I also used a ps | grep and i can see the process id is there a way to output it though?

Script to automate URL opening in multiple tabs in Firefox or Opera from a text file

半城伤御伤魂 提交于 2019-12-22 00:56:18
问题 I have a text file with lots of links-each line has a link (i.e the separator is '\n'). i want to write a script so that each link opens in a different tab in Firefox or Internet explorer. How can I do this? I'm on Windows 7 回答1: Create a text file called whatever.bat and put it on your desktop. edit the file and enter: set "fileList=" FOR /F "usebackq delims==" %%i IN ("C:\Documents and Settings\mdevine\Desktop\urls.txt") DO call set "fileList=%%fileList%% %%i" start firefox %fileList% close

Get result from shell script objective-c

我与影子孤独终老i 提交于 2019-12-22 00:53:52
问题 I would like to run a shell script, from a file or from an objective-c string (within the code). I would also like the shell script's result to be stored to a variable. I would not like the shell script to be split into arguments (such as setLaunchPath when I run it). For example: running this shell script "mount_webdav idisk.mac.com/mac_username /Volumes/mac_username" instead of "/bin/mount_webdav" then the arguments. Is there anyway to do this? I am using NSTask right now, but it has caused

How to send javascript object from one page to another page?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 23:22:36
问题 Assume i have javascript object called "call" and i have stored some values in it and i want to access the same object "call" not values. This type of approach is it possible? If yes plese explain with simple example. I know there are several ways we can send the object properties values from one page to another page by using post url, header, cookies so on but my requirment to access the whole object instanse form one page to another page. Anything in this regard highly appreciated. Thanks

Better way to check linux version?

怎甘沉沦 提交于 2019-12-21 21:43:42
问题 What I currently have. Is this the best way? Have a script with lots of functions and need a way to know what OS is running before running each function. CHECK_architecture() { architecture=`uname -m` if [ "$architecture" != "x86_64" ] && [ "$architecture" != "ia64" ]; then architecture="x86" else architecture="x86_64" fi } CHECK_distro() { DISTRO=""; if [ `uname -r | egrep '(6.2-RELEASE|6.1-RELEASE|5.5-RELEASE|6.1-STABLE|5.4-RELEASE|6.0-RELEASE|5.3-RELEASE|4.10-RELEASE|4.11-RELEASE)'` ];

Script to open executables and snap to top left hand corner of desktop

不羁的心 提交于 2019-12-21 21:01:20
问题 I was just wonderin' in a .bat file, if there was a way to call an external .bat file, or even an *.exe and make it open so it 'snaps' to the top left hand corner of the screen ? Cheers 回答1: There is no direct way to position a Window from the Windows command prompt. You basically have the following options: Use a GUI automation tool, e.g. AutoHotkey which lets you script window actions. AutoHotkey e.g. offers the WinMove command: Run, calc.exe WinWait, Calculator WinMove, 0, 0 ; Move the

Running script on Exchange 2010

你。 提交于 2019-12-21 20:47:50
问题 I want to run a script when an email is received on my exchange server. I really don't have a great direction on how to implement this. I've written my script in VB and tested it on outlook. I incorrectly assumed you can run a script from a rule in Exchange like you can in Outlook. Any help would be greatly appreciated. Should I be using smtpreg.vbs or EWS or something completely different? 回答1: Exchange used to rely on event sinks for this kind of processing, but this is deprecated and not