shell

Mac OS X - run shell script from the desktop GUI

You can create a shell script or a Python or Ruby script and run it on the Mac by using "Terminal" ... if you have Finder open, and you click on the icon for the file containing the source code of a saved shell script, is there a way to have that script run, instead of opening in my text editor ? ...

Shell scripting to perform regex match/replace

I'm using cURL to get a web page and present to our users. Things have worked well until I came upon a website using considerable amounts of Ajax that's formatted so: 33687|updatePanel|ctl00_SiteContentPlaceHolder_FormView1_upnlOTHER_NATL| <div id="ctl00_SiteContentPlaceHolder_FormView1_othernati...

SSH/Shell - Remove all folders with name "____" within folder AND subfolders

I have a script that is copying a folder that contains a couple sub folders. The original that it is copying from is part of an SVN folder, so it is copying those ".svn" folders as well. I want to remove those from the new destination, my best guess was: rm -Rf dir/*.svn Which doesn't work, is there a way to do this or do I need to ...

How netbeans installation file (bash file) contains Java code?

Hi folks, I wonder, how a bash file can contain a Java code that is responsible about the installation of netbeans IDE which is as known is a Java based program? this is the case of netbeans: $ file netbeans-6.8-ml-java-linux.sh netbeans-6.8-ml-java-linux.sh: POSIX shell script text executable $ more netbeans-6.8-ml-java-linux.sh #!/b...

shell tool which renders web site including javascript

Hi, we want to test our webpages on linux shell. For that reason I'm looking for a shell tool, which gets the html page from server (like 'wget') and then executes contained Javascript, include pictures and so on. After this, the tool should give me a 'screenshot' of the rendered page, so that I can create a checksum for that screen. (So...

Example of xargs' -x option in action

GNU xargs has option '-x'. The man page says: -x Exit if the size (see the -s option) is exceeded. But xargs seems to not care if -x is set or not. I have been unable to make an example in which the -x has any effect at all. Please provide two examples in which the only difference is an added -x and that produce different outp...

Interacts with dialog/whiptail on early boot rcX.d stage?

Hi buddies, I'm developing on Ubuntu based, actually I got one script in-charged on GUI(console) setup. It runs before another scripts (rcX.d) start. Currently, I installed this script on rc2.d and start earlier than other ones. But when run on real machine, I can't input any keystroke on "dialog --inputbox" or whiptail through shell ...

Delphi Shell IExtractIcon usage and result

I am developing a listview baised on the shell. When trying to extract a shell icon/image... I try to extract thumbnail using IExtractImage if that fail I try to extract icons using IExtractIcon, to get maximum iconsize, but IExtractIcon gives strange results. Problem is I tried to use a methode that extracts icons from an imagelist but ...

How do I find the current virtual terminal

I am working around a problem in Ubuntu 10.04 where after resume, the mouse cursor disappears. This can be "fixed" by running chvt 1; chvt 7 in a script in /etc/pm/sleep.d, such that those commands run on thaw and resume. However, the X console is not always vt #7, so chvt 7 is wrong in those cases. What I would like to do is find out...

How to start a Python ipython shell, automatically run inside it a few commands, and leave it open?

I tried echo "print 'hello'" | ipython Which runs the command but ipython immediately exits afterwards. Any ideas? Thanks! Edit: I actually need to pass the command into the interactive Django shell, e.g.: echo "print 'hello'" | python manage.py shell so the -i switch gimel suggested doesn't seem to work (the shell still exits af...

Is there a Scala version of .irbrc or another way to define some default libraries for REPL use?

I've written a little library that uses implicits to add functionality that one only needs when using the REPL in Scala. Ruby has libraries like this - for things like pretty printing, firing up text editors (like the interactive_editor gem which invokes Vim from irb - see this post), debuggers and the like. The library I am trying to wr...

How to run a tcsh shell command and selectively ignore the status?

I've got a tcsh shell script that I would like to stop with an error on nonzero status most of the time, but in some cases I want to ignore it. For example: #!/bin/tcsh -vxef cp file/that/might/not/exist . #Want to ignore this status cp file/that/might/not/exist . ; echo "this doesn't work" cp file/that/must/exist . #Want to stop if th...

How to get the Handle that is executed in winexec or shellexecute?

i use to create a custom function like winexec(...):Hwnd that will retun the handle of executed application. i did use the findwindow() but having problem if it change window caption. ...

Multi-line code in PHP interactive shell

I'm learning to use the PHP interactive shell, but I'm having trouble with multi-line code. Using backslashes like in the UNIX shells doesn't seem to work. What am I doing wrong ? php > function test(){\ php { echo "test";\ php { }\ php > test(); PHP Parse error: syntax error, unexpected T_ECHO, expecting T_STRING in php shell code on...

Creating standalone, console (shell) for domain-specific operations

Say that I have a system service, and I want to offer a low-level maintenance access to it. For that purpose, I'd like to create a standalone, console application that somehow connects to server process and lets user type in commands, allow it to use auto-completion and auto-suggestion on single/double TAB press (just like linux bash sh...

exeuting command in background

Hi, Trying to execute shell command in background using pythons commands module >>>import commands >>>output = commands.getstatusoutput("find / > tmp.txt &") sh: Syntax error: ";" unexpected Can anyone explain what is wrong with the syntax ? How should it be executed then ? Tazim. ...

Shell extensions with .NET 4.0

Any one have any docs or examples of how to add menu items to the explorer shell with .NET. Can only find info saying it should be possible now with .NET 4.0 but not how to do it. ...

CommonAppData in vb6

Basically the same as this question, but for VB6. A customer's application "AppName" has its configuration files stored in CommonAppData. Under Windows XP that is C:\Documents and Settings\All Users\Application Data\AppName Under Windows Vista that is C:\ProgramData\AppName How do I get the correct foldername ...

android : how to run a shell command from within code

I am trying to execute a command from within my code, the command is "echo 125 > /sys/devices/platform/flashlight.0/leds/flashlight/brightness" and I can run it without problems from adb shell I am using Runtime class to execute it : Runtime.getRuntime().exec("echo 125 > /sys/devices/platform/flashlight.0/leds/flashlight/brightness")...

Bash: Is it ok to use same input file as output of a piped command?

Consider something like: cat file | command > file Is this good practice? Could this overwrite the input file as the same time as we are reading it, or is it always read first in memory then piped to second command? Obviously I can use temp files as intermediary step, but I'm just wondering.. t=$(mktemp) cat file | command > ${t} &&...