shell

Compiled vim from source on Mac OSX and getting 'shell returned 127' error?

Hello. On my Mac OSX 10.6 machine, I started to use MacVIM for vim. Then I noticed my terminal version was different to the MacVIM version (MacVIM was 7.3 and my terminal version 7.2)... I thought they used the same vim? I need 7.3 for some of the features. So I set about wanting to update the terminal version. I basically cloned it us...

Use shell utilities for equivalent of SQL group by on a CSV file

I've got a csv file where the left most column contains an ID field. Is there a clever way I can use any utility programs such as sed to find any ID's that are used more than once? ...

Change working directory in shell with a python script

I want to implement a userland command that will take one of its arguments (path) and change the directory to that dir. After the program completion I would like the shell to be in that directory. So I want to implement cd command, but with external program. Can it be done in a python script or I have to write bash wrapper? Example: ...

How to define apache's logrotation's file name using an external shell script

Guys, I have apache running on different servers, I would like to rsync log files back to a centralised server on a daily basis. I can use log rotate to create log file for a day and put it in a directory that gets rsync'd to the central server. However is there any way to set the log filename with a designation that could be read from ...

What do backticked options mean?

I noticed this command: gcc -Wall `libnet-config --defines` libnet-example-x.c -o libnet-example-x `libnet-config --libs` What is the meaning of libnet-config --defines and libnet-config --libs? ...

Sending keyboard input to a program from command-line

How do you send keyboard input to a program? That is, under a Linux GUI, is there a good manual (programmable) way, or tool, of simulating keyboard input on a running program on Linux, so that I can send from the command-line, e.g., "Control-T" to a Firefox process and "echo 'hello'\n" to a Gnome-Terminal process without actually focusi...

Use of shell variable inside command

Hi, my server is using CentOS 5.5 (which is almost Red Hat Linux). I want to backup a set of pictures into time-stamped files. This code would work: z_cmd1=$(tar cvzf /home/user1/public_ftp/misc/pics_20100925_142230.tar.gz /home/user1/public_html/misc/_pics_var/F???????.jpg) echo "tar output =[${z_cmd1}]" but of course I want the...

How do I get just real time value from 'time' command?

I would like to make a script that outputs only the real time value from the time command so I can plot the results. For example time command outputs real 1m0.001s user 1m0.000s sys 0m0.001s I want to write a script that outputs 60.001 How do I get just real time value from 'time' command in seconds? ...

How is the PATH env variable set when opening a BASH shell in Terminal.app on OS X?

What startup scripts—in the order that they are called—set the PATH variable when opening a BASH shell in Terminal.app on OS X? ...

Run a java program in shell script

Possible Duplicate: run a java program Hi guys I want to run a java program using shell script. The java program is in p2 directory and its name is maxconnect4. I write the shell commands like this: java p2/maxconnect4 arg1 arg2 arg3 This shell command does not work. However, I compile the java program in this way: javac ...

run a java program

Hi guys I want to run a java program using shell script. The java program is in p2 directory and its name is maxconnect4 and I have already compiled it, the class name is maxconnect4. I write the shell commands like this: java p2/maxconnect4 arg1 arg2 arg3 This shell command does not work. It give an error: Exception in thread "main" ...

How is possible to create a python shell script like top unix command?

Hi to all I'm need to create a Python shell script that refresh output every n seconds like top unix command. what 's the best way to do this? ...

Why doesn't Perl find my script when I use the -I switch?

I have googled a way to do this kind of thing. I use this shell command: perl -I/p2 maxconnect4.p1 arg1 arg2 arg3 arg4 My pl files and pm files are all in "p2" directory. However, it gives me an error: Can't open perl script "maxconnect4.pl": No such file or directory Can anyone explain why? ...

Windows Shell Context Menu recreated with qt

Is there a way to query from qt the entries of the shell context menu (name and command)? Only if the application is run on Windows of course. ...

sed in makefile, usage

hi, I am in the process of learning makefile creation. Current target is to scan the $(SOURCEDIR) for .c files and create (according to that lise of .c file paths in the format of /path/file.c) a nice $(VPATH) so I do not need to use recursive makefiles (aka pain in the a..). Atm I am stuck with this, where $(SOURCETREE) will be empty ...

Using getopt in unix shell

I have to use a Unix script to pass arguments: ./Script.sh -c "abc" -d "def" -k "abc -d -c" where the argument for: -c = "abc" -d = "def" -k = "abc -d -c" How can I handle options in a Uunix shell script? ...

issue in getopt , Unix shell script

Hi can someone fix this issue, i am not able to get outpt. I am not able to get output of -p. #!/bin/bash args=`getopt c:m:p $*` if [ $? != 0 -o $# == 0 ] then echo 'Usage: -c <current-dir> -m <my dir> -p <argument>' exit 1 fi set -- $args for i do case "$i" in -c) shift;CURRDIR=$1;shift;shift ;; ...

run out of system resource (execute many programs in a shell script)

Hi guys I'm running a shell script on the university's server. In this shell script, I will execute java, c, c++, python and perl programs. Because every program will be executed many many times(I'm a teaching assistant and will test the students' programs with many different inputs). The server always gives me an error: "running out of...

signal acknowledgement

how to kill a child process on sending an interrupt with key stroke and then sending a signal to parent that the child process has been killed? ...

Python unicode popen or Popen error reading unicode

Hello, I have a program that generates the following output: ┌───────────────────────┐ │10 day weather forecast│ └───────────────────────┘ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ Tonight Sep 27 Clear 54 0 % Tue Sep 28 Sunny 85/61 0 % Wed...