shell

Linux shell (bash) on vi's splitview

Hi all, I've been searching with no results for an integration of bash inside vi, as featured in emacs; the problem is: I have vi open with 2 views, one open with :split command, and I want to use bash through the second view, while I'm editing a file in the first; if I do :sh while editing the second view, the whole session pauses and a...

save and restore shell variables

I have two shell scripts that I'd like to invoke from a C program. I would like shell variables set in the first script to be visible in the second. Here's what it would look like: a.sh: var=blah <save vars> b.sh: <restore vars> echo $var The best I've come up with so far is a variant on "set > /tmp/vars" to save the variables and...

NSTask sending an argument through /bin/sh or /bin/bash problem Cocoa Objective-C

Hello, Basically I've passed a script in the terminal through /bin/bash "[path]" or /bin/sh "[path]", and I've passed commands in a terminal through /bin/bash -c "[command]" or /bin/sh -c "[command]". Both ways work properly. But in my Cocoa App, when I try to do the exact same thing with NSTask (using /bin/bash or /bin/sh), the app see...

What Is the Purpose of the `:' (colon) GNU Bash Builtin?

The question says it: what would be the purpose of a command that does nothing, being little more than a comment leader, but actually a shell built-in in and of itself. It's slower than inserting a comment into your scripts, by about 40% per call, which probably varies greatly on the size of the comment. The only possible reasons I can ...

Execute another app which is not url/sms and etc.

I would like to execute another app from my app like "Angry Birds"/"Seance"/"Guitar Hero". (I know its against the rules of apple :) Is there a way I can do it? Thanks ...

TARing relatively.

Hi, I'm writing a script that can tar any given folder and place it in my home/bkp. the script will read like this, tar czvf /home/me/bkp/`basename $1`.tar.gz $1 well now, to use it., backup-script.sh /home/me/folder/sub/to-be-backed-up/ Well and good. Now when I untar it, it creates home/me/folder/sub/to-be-backed-up/*file...

How to search for a time value in a log file using shell and awk?

I have a script where a user provides a date, start time and end time. The script will take these values and scan a log file to search for key words in the log file that fall within the time range. When a user uses AM times (Example: 0700 to 0900 - this is 7am to 9am) as a range or PM times (Example: 1400 to 1600 - this is 2pm to 4pm) as...

Stop invoking of new Shell/cmd prompt , python

hi friends., i have a python script which should invoke a .exe file to get some result. That .exe file is invoking a new windows command prompt(shell) . i dont need any output from the .exe file. i 'm using os.system('segwin.exe args') in my script where segwin is an executable. now my question is : i need to stop invoking cmd prompt...

How to find the difference between 2 files in shell script

There are 100 files in dir and there are 2 pairs of file. I want to find the difference between 2 files in shell script File 1: Operating System : Windows XP Operating System : Windows NT Operating System : Windows 2008 FILE 2: Windows XP Windows NT Windows2008 ( e.g Windows 2008 ( file 1 ) and Windows2008 ( file2) ) . But fina...

inserting date into sql script

i am doing sql server backups like this in script: BACKUP DATABASE databasename TO DISK = `path' since this backup is going to be automated, how do i insert today's date into 'path' ? ...

How to view the method members of a class within a jar file thru the command line

I am trying to look at the method members of a class within a jar file. Currently to list all the classes within a jar file, one can call this command: jar -tf myjar.jar but if i want to list the public methods within a particular class in this jar file, How do i go about it. Thanks ...

How to become non-root in the middle of a shell script run as root? Possible?

Let's say I have a shell script that runs a bunch of other sub-scripts. I decide that my script must be run as root because the first several sub-scripts that it runs need to be run as root. However, there are two sub-scripts run by the super-script that cannot be run as root. Assuming my script was run as root, how do I de-root it fo...

Is there a way to call ruby1.9 without loading rubygems?

So ruby 1.9 is really nice in that it'll automatically require rubygems, and hence when you call require 'somegem' without first requiring rubygems it'll work, and that's generally awesome. But I have a ton of shell scripts using ruby, and they generally don't rely on rubygems. Shell tools should run instantly, and loading rubygems for ...

Escaping * char in cshell alias

Escaping * char in cshell alias i want to write a C Shell Alias which can find files starting with a pattern ie equivalent of find . -name "pattern*" myfind pattern should do above cmd where myfind is the alias name. How do i escape the * in csh alias ? alias myfind 'find . -name !**' ...

Solaris 10 /bin/sh forks on indirection

I have noticed that Solaris 10's Bourne shell, /bin/sh (and also /sbin/sh) forks a subshell when using indirection (<). I have tried a pile of other Bourne-ish shells, including: The POSIX /usr/xpg4/bin/sh shell on Solaris 10 /bin/bash, /bin/ksh on Solaris 10 /bin/sh on AIX 5 /bin/sh on Debian Linux 5 and none of these exhibit this b...

help running a dos script with a space in it

i am running this: C:\Program Files\Microsoft SQL Server\80\Tools\Binn\osql -E -S Sql server-hl7\timeclockplus timeclockplus.sql -oresults.txt and it doesnt like that there are spaces in the directory. how do i fix this problem? ...

Windows port required

I'm trying to port a piece of code, written in Java (see below), from Linux to Windows and struck at a point. String sh = "/bin/sh"; String cop = "-c"; String cmd = "netstat -a | grep 9000 | wc -l"; String[] exe = new String[] {sh, cop, cmd}; Process FindCon...

Start serval applications and pipe it to current terminal

How can I start serval applications in one script and pipe the output to current terminal? For development I need a script which starts three webservers (on three ports, of course) and pipe the output of these to current terminal. The difficult is to stop these webservers at the end of shell. I have to send a signal or better send [Ctr...

What is shell scripting?

What exactly is shell scripting? And what is Bash, Korn, and Expect? I use a few commands in a Linux terminal, is that shell scripting too? Again I am confused what exactly is shell scripting? ...

shell script to quickly jump to a directory

I am using mac. When I do p demo on my terminal then I want to go to cd /Users/dorelal/prod_demo I tried adding following commands to my ~/.bashrc but none of them worked. alias p='cd /Users/dorelal/prod_$1' function p { cd '/Users/dorelal/prod_$1' } ...