shell

How can I run a shell command from my cocoa app?

I want to run a simple command from my cocoa app through code, NOT creating a shell script and running it that way, but by running it through the application, being able to define everything and change it on the fly ...

Simple way to colour alternate output lines in bash

I have need to grep an entire directory for a string, and I get about 50 results. I would like to colour each second line, either text colour or background colour. Best would be a script that I can pipe the output of any command to, and so that it spits out the same (albeit coloured) output. ...

Windows Shell: Pipe to a script...

Dear Experts, I'm writing a script that should process a contents of a file, but should be file-independent. The second step would be using the script few times in pipe as follows: type input.txt|script.bat ...|script.bat ...|script.bat ... > output.txt Is it possible to use either of the following syntax: type input.txt|script.bat ...

How to set shell variables in subprocess.Popen (in a less ugly way...)

NOTE: This is not the same question as Python: Persistent shell variables in subprocess, as that question is actually about environment variables, not shell variables. I'm trying to automate a basic benchmark that I'm doing in csh using the shell built-in time command. You can tweak the output of time by setting the variable of the sam...

$$ in ksh shell

Please tell me the meaning of $$ in ksh shell? I guess it is associated with the process id but I want to know its exact meaning. ...

Get the result of a Shell Commands within C

Hi all! I'm trying to find a function to call a system command (shell command) and get back its result in a C program. I only found functions like system but these don't return the result of the command. I just know it in perl : my $results = `my shell command ; Thanks! ...

Remove slash from the end of a variable

hi folks, the bash auto completion make a / at the end of a directory how i can strip this out? Thanks for hints. #!/bin/sh target=$1 function backup(){ date=`date "+%y%m%d_%H%M%S"` PWD=`pwd` path=$PWD/$target tar czf /tmp/$date$target.tar.gz $path } backup ...

Tie the life of a process to the shell that started it.

In a UNIX-y way, I'm trying to start a process, background it, and tie the lifetime of that process to my shell. What I'm talking about isn't simply backgrounding the process, I want the process to be sent SIGTERM, or for it to have an open file descriptor that is closed, or something when the shell exits, so that the user of the shell ...

killall httpd for sleep process

Hello guys this shell explain the issue , after executing the .sh file halt and nothing happen , any clue where is my mistake its kill httpd if there is more than 10 sleep process and start the httpd with zero sleep process #!/bin/bash #this means loop forever while [ 1 ]; do HTTP=`ps auwxf | grep httpd | grep -v grep | wc -l`; #the...

Shell command to send file via bluetooth on Mac OS x

Hi, is there any way to use a shell script under mac os x to send a file via bluetooth ? thanks in advance Nikko PS: anyone having a solution under windows is welcome too ... ...

Getting the last argument passed to a shell script

$1 is the first argument. $@ is all of them. How can I find the last argument passed to a shell script? ...

Using apple's Automator to pass filenames to a shell script.

I have an automator script that I'd like to run on a folder. I want the script to take each file in the folder and run my shell command on it. Automator is set to pass input to stdin, but I don't think I'm using stdin correctly below, can you help please? for f in "$@" do java -Xmx1000m -jar /Users/myprog/myprog.jar $f done ...

I'm trying to make bookmarks in Filezilla be availble on the desktop

So far it only looks like the bookmarks you make become available inside Filezilla[1] but I want to make them show up on the desktop like shortcut links. Maybe a shell script would work? I am trying to find (arguments/parameters/options) what I can pass into filezilla via a command line but no luck so far here/google/etc. I'm checking o...

Grep and regular expression

I need some way to find words that contain any combination of characters and digits but exactly 4 digits only. EXAMPLE: a1a1a1a1 //OK 1234 // Not a1a1a1a1a1 Not ...

XArgs command on cygwin is mangling file paths

I'm trying to use xargs on a Cygwin Windows system to remove SVN files deleted locally. I run the following command that generates the following output: svn status | grep '^\!' | sed 's/! *//' weblings-webplatform\vendor\jetty-7.0.0.pre5\contexts-available\test-annotations.d\META-INF\MANIFEST.MF weblings-webplatform\vendor\jetty...

Why is makefile shell result different than doing same in shell?

With a GNU makefile content of: SVNVERSION_NUMBER := $(shell svnversion --version | perl -lne 'print $1 if /version (\d+.\d+.\d+)/') $(error $(SVNVERSION_NUMBER)) I get a result of: Makefile:3: *** svnversion, version 1.6.2 (r37639). Stop. However, at the shell if I type: svnversion --version | perl -lne 'print $1 if /version (\...

How to get $this->translate('Content') => Content in a Textfile

I am looking for a shell script which scans a direcotry and all its subdirectories for .php and .phtml files. Within these files, I am looking for $this->translate('') statements (also $this->view->translate('')) and I want to save the content of these statements in a textfile. The problem is, that there are several different types of t...

Offset from GMT standard time

Does Unix store the offset of the machine from GMT internally? like for eg:india standard time is GMT + 5:30.is this 5:30 stored some where? i need this to use it in a script like below if[[ off is "some value"]] then some statements fi ...

changing to parent directory in unix

in general we use cd .. for going to the parent directory cd ../../ to go to the parents parent directory. and cd ../../../../../ for 5th parent directory. is there any simplified way of doing this? shell i am using is ksh. ...

Excecute iwconfig from a java application

Is it possible to execute iwconfig (or any other shell based program) from a java application and then parse the output somehow? If yes, how? ...