I've just started doing some PowerShell scripting, and I'm running into a problem testing variables for a value. I try to run everything with all warnings enabled, especially while I'm learning, in order to catch dumb mistakes. So, I'm using CTPV3 and setting strict mode on with "set-strictmode -version latest". But I'm running into a ro...
I have a DOS batch script that invokes a java application which interacts with the user through the console UI. For the sake of argument, let's call it runapp.bat and its contents be
java com.example.myApp
If the batch script is invoked in a console, everything works fine. However, if the script is invoked from the Window Manager, the...
Is it possible to get, using Bash, a list of commands starting with a certain string?
I would like to get what is printed hitting <tab> twice after typing the start of the command and, for example, store it inside a variable.
...
In bash
echo ${!X*}
will print all the names of the variables whose name starts with 'X'.
Is it possible to get the same with an arbitrary pattern, e.g. get all the names of the variables whose name contains an 'X' in any position?
...
Anyone know of any examples that shows COM programming via Lua? Could require a library.
I need to write some external scripts for Photoshop, so wondering if it's possible with Lua.
...
I am working on TTCN-3 (Testing and Test Control Notation) scripting language. I wanted to prepare on guideline checker for this code files.
For that I want to read lines of TTCN-3 script file( some thing like file.ttcn ) one by one into a buffer. But for me fopen / sopen / open / fgetc / fscanf are not able to work properly and are not...
I'm trying to dig through some logs and need information before and after the line I can match on. How would I do this in powershell ala "grep -C 2"?
Edit: in version 1 --I can't wait for r2, then I get to put it on production machines :)
...
Hi all,
Can someone help explain the following:
If I type:
a=`ls -l`
Then the output of the ls command is saved in the variable a
but if I try:
a=`sh ./somefile`
The result is outputed to the shell (stdout) rather than the variable a
What I expected was the result operation of the shell trying to execute a scrip 'somefile' to b...
I saw that there is a virtual() function in PHP that will call a CGI script, but is that the best way? Can I pass any parameters to that scripts as well?
I saw some examples using file_get_contents() or include() and passing in the URL of a CGI script, but that feels like a hack.
...
I have written some VBScripts to automate tasks that I perform on computers over the network. These work great for most tasks however within our network we have problems with the IP address in DNS being correct all the time. This mainly occurs with laptops where we have different IP ranges for machines on the wireless and wired network...
Hello,
I need to change the connection speed of a port on a switch via program or script. Possible choices are 100M Full Duplex, 10M Full and 10M Half Duplex.
The server runs a Linux Debian. The switches are "talked to" via SNMP.
How can I do it? Best would be Perl and/or PHP.
...
Any ideas how to echo or type the last 10 lines of a txt file?
I'm running a server change log script to prompt admins to state what they're doing, so we can track changes. I'm trying to get the script to show the last 10 entries or so to give an idea of what's been happening recently. I've found a script that deals with the last line, ...
Hi,
My webpage with diffrent sites should just load one .js file for cache optimizing.
The problem comes up, when the file is loaded. It applies the listener on every page to the form elements (for example) so, just the last page's form acts like it should, the others does not cause their actions were overwritten.
So my question, how c...
I have a Cygwin bash script that I need to watch and terminate under certain conditions - specifically, after a certain file has been created. I'm having difficulty figuring out how exactly to terminate the script with the same level of completeness that Ctrl+C does, however.
Here's a simple script (called test1) that does little more t...
I'd like a daemonizer that can turn an arbitrary, generic script or command into a daemon.
There are two common cases I'd like to deal with:
I have a script that should run forever. If it ever dies (or on reboot), restart it. Don't let there ever be two copies running at once (detect if a copy is already running and don't launch it ...
Whats the simplest way to do a find and replace for a given input string, say "abc", and replace with another string, say "XYZ" - the the file, /tmp/file.txt?
I am wrtting an app and using IronPython to execute commands through SSH - but I dont know unix that well and dont know what I am looking for.
I have heard that Bash script, apar...
Hello everybody!
I'm currently porting a my tiny space game project from Delphi 2007 Win32 to C#(and XNA). In Delphi, i used RemObjects Open Source scripting solution "PascalScript".
Now that i continue developing the game with C#, i'd like to use IronPython for scripting purposes.
The only problem is, that i don't know how to achie...
I have 12 columns separated by a tab. How can I join them side-by-side?
[Added] You can also tell me other methods as AWK: the faster the better.
...
I need to execute a PowerShell script from within C#. The script needs commandline arguments.
This is what I have done so far:
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration);
runspace.Open();
RunspaceInvoke scriptInvoker = new Run...
How to open a prompt dialog box in WSH usig JSacript??
The only pop-up dialog I've found in the doc is the WshShell.Popup() method. But I need a way to request the user to enter a string, like the window.prompt() method in DOM.
Thanks.
...