unix

web/unix interface: what to use?

Hello! I wish to make a simple web page, which will strongly interact with unix commands behind. And I'm sure there exist some wonderful technology out there which would be suited to do just that and get you running in a couple of hours. I just don't know which one. Now, please let me explain what I intend to do. Basically, it is very...

rules for makefile

hello everyone, let's assume I have some Makefile for Unix prog:a.o b.o c.o gcc a.o b.o c.o -o prog a.o:a.c a.h b.h gcc -c a.c b.o:b.c b.h gcc -c b.c c.o:c.c c.h b.h gcc -c c.c I read that if I change *.c file I must recompile only this file, but if I change *.h file I must recompile all files which are depending on my...

UNIX: find a file in directories above $PWD

I want to find a file with a certain name, but search in direcotories above the current one, instead of below. I'd like something similar to: (except functional) $ cd /some/long/path/to/my/dir/ $ find -maxdepth -1 -name 'foo' /some/long/path/to/foo /some/foo Shell scripts or one-liners preferred. In response to the several questi...

How to send commands to telnet and leave session open

I have to connect to a remote server via telnet and want to send file input there. This is a processor emulator (MCF68k), so I can't just scp the file to the server and run from there. I can send input like this: telnet host.name < input.file Which will successfully transmit the data to the server and run the commands stored that I w...

Generating Vector of Random Number (of Size M) from -K to K in C++

Is there a fast way to do that? ...

Checking if a directory exist in Unix (system call)

Hello, I am not able to found a solution to my problem online. I would like to call a function in Unix, pass in the path of a directory, and know if it exists. opendir() returns an error if a directory does not exists, but my goal is not to actually open, check the error, close it if no error, but rather just check if a file is a direc...

adding word to a field common to all records in a file

Hi, I want to add a word to field 1 of a file separated by space,for example My file,containing two fields: apple:fruit:tree orange:fruit:tree mango:fruit:tree brinjal:vegetable:plant potato:vegetable:root now I want to add word "family" separated by space to the field 1. Therefore, the resultant file should look some thing like t...

how i can pass argument to windows 2003 batch file and execute it from unix-aix and return value to unix-aix

how i can pass argument to windows 2003 batch file and execute it from unix-aix and return value to unix-aix ...

Standard error not getting redirected from this java command in bash

I have the following shell script. For some reason the java program's standard error and standard output is not printed to the file "log" but instead always appear in the console. Is there a type some where or am I missing something? JAVACMD="java -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxre...

Array Performance very similar to LinkedList - What gives!?

So the title is somewhat misleading... I'll keep this simple: I'm comparing these two data structures: An array, whereby it starts at size 1, and for each subsequent addition, there is a realloc() call to expand the memory, and then append the new (malloced) element to the n-1 position. A linked list, whereby I keep track of the head, ...

How to simulate key press event?

How to simulate key press event with ksh|bash script? ...

Hiding secret from command line parameter on unix

Hi, I have the following problem: I've a script that launch inside of itself a command with a parameter that is a secret. For example: #!/bin/bash command secret While running the command I can read through ps -ef | grep command which is the secret. Is ther any way of hiding the secret in a way that through ps -ef the command line...

how i can execute windows batch file from UNIX-AIX ?

how i can execute windows batch file from UNIX-AIX i install copssh ??? ...

difference between the content of two files

I have two files one file subset of other and i want to obtain a file which has contents not common to both.for example File1 apple mango banana orange jackfruit cherry grapes eggplant okra cabbage File2 apple banana cherry eggplant cabbage The resultant file, difference of above two files mango orange jackfruit grapes okra An...

Is there a good way to submit jobs to a cluster using bash?

Is there a good tool out there to do this on a Linix machine using the bash shell? All I need is to issue different commands on a set of nodes in a cluster and when one of them is done with the job, I'd like to submit another one. Something very similar to what Hadoop can do. I would be interested in knowing the status of the job as well...

How can I get the user id associated with a login on Linux?

Short version: I want a way to run somefunction("username") and have it return the user ID associated with username. For example somefunction("root") would return 0. I'm writing a server program that could potentially use low-numbered ports, so it has to start as root. Obviously, I don't want it to run as root, so the plan is to let use...

Bash read/write file descriptors -- seek to start of file

I tried to use the read/write file descriptor in bash so that I could delete the file that the file descriptor referred to afterward, as such: F=$(mktemp) exec 3<> "$F" rm -f "$F" echo "Hello world" >&3 cat <&3 but the cat command gives no output. I can achieve what I want if I use separate file descriptors for reading and writing: ...

Java to re-read environment keycodes?

I have a really nasty problem. My java application is running on unix and I'm using VNC to connect (from windows). The problem is that VNC has some issues with registering non-ansi keysum's. KbdAddEvent: unknown KeySym 0xc0 - allocating KeyCode 117 Even so, keyboard input works correctly in xterm, mozilla and etc. But when I'm us...

Linux ipconfig command

I am a new user of Linux and have freshly installed RHEL5 operating system on 1 of my system. I have chosen DHCP during installation. Now after installation when I tried to run ipconfig command on the shell prompt I got this message bash: iconfig: command not found I am a root user. I do not understand why am I getting this error. M...

Find All Possible Combination of Features (Column) in a Tab Delimited Data

I have a data that looks like this: 1 1:-0.394668 2:-0.794872 3:-1 4:-0.871341 5:0.9365 6:0.75597 1 1:-0.463641 2:-0.897436 3:-1 4:-0.871341 5:0.44378 6:0.121824 1 1:-0.469432 2:-0.897436 3:-1 4:-0.871341 5:0.32668 6:0.302529 -1 1:-0.241547 2:-0.538462 3:-1 4:-0.871341 5:0.9994 6:0.987166 1 1:-0.757233 2:-0.948718 3:-1 4:-0.871341 5...