unix

updating macport gives me the following error

Staging ncurses into destroot Error: Target org.macports.destroot returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_ncurses/work/ncurses-5.7" && /usr/bin/make install DESTDIR=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_re...

printf anomaly after "fork()"

OS: Linux, Language: pure C I'm moving forward in learning C progpramming in general, and C programming under UNIX in a special case :D So, I detected a strange (as for me) behaviour of the printf() function after using a fork() call. Let's take a look at simple test program: #include <stdio.h> #include <system.h> int main() { int...

Creating a child process on Unix systems?

I'm trying to create a child process in another process. I am writing both the programs in C language. First I write a dummy process which will be the child process. What it is doing is only to write a string on the screen. It works well on its own. Then I write another program which will be the parent process. However, I can't make it h...

Close socket and select()

So I need to close a particular connection, but the problem is another thread is, at the same time, doing a select() which has the socket as one of the file descriptors it's watching. Will the select() terminate gracefully, or will anything bad happen? ...

SUA + Visual Studio + pthreads

Hi, I cannot compile this code under SUA: #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <pthread.h> void * thread_function(void *arg) { printf("thread_function started. Arg was %s\n", (char *)arg); // pause for 3 seconds sleep(3); // exit and return a message to another thread // that may ...

Unix [Homework]: Get a list of /home/user/ directories in /etc/passwd

I'm very new to Unix, and currently taking a class learning the basics of the system and its commands. I'm looking for a single command line to list off all of the user home directories in alphabetical order from the /etc/passwd directory. This applies only to the home directories, and not the contents within them. There should be no d...

What are the calling conventions for UNIX & Linux system calls on x86-64

Explains both UNIX (BSD flavor) & Linux system call conventions for x86-32: http://www.int80h.org/bsdasm/#system-calls http://www.freebsd.org/doc/en/books/developers-handbook/x86-system-calls.html Can any one please tell me or point me to similar doc for x86-64 on both UNIX & Linux? ...

unix shell script - extract file name

I have a variable which has the directory path along with file name. I want to extract the filename alone from the unix directory path and store it in a variable fspec="/exp/home1/abc.txt" ...

GLOB_BRACE portability?

In this question, I was made aware of glob()'s GLOB_BRACE option that allows for a limited set of regular expressions when searching for files. This looks just like what I need, but according to the manual, GLOB_BRACE is "not available on some Non-GNU Operating systems." Among those seems to be Solaris. I am building an application th...

deleting a directory in solaris,Ksh

rm -r /cbbconfg/BRCH/tmp rm: cannot determine if this is an ancestor of the current working directory ...

dynamic linking:change of the linking path.

Normally it happens that when ever the path of the library that has to be linked dynamically is defined in LD_LIBRARY_PATH or it it will be mentioned with -L flag while creating the binary. In actual scenario if ,lets say the binary has been built and deployed at the client place. Now if there is a change in the path of one of the dyn...

Checking status after wait()

After creating a child process and exiting it immediately (_exit()), I want to perform a wait and check the status. Now I wonder if in the 'else' branch of the if/else construct I also need to check for WIFSIGNALED. As far as I understand, if I perform a wait, a) an error could have occured (-1), the child could have terminated normally ...

unix ksh retrieve oracle query result

Hi guys. I'm working on a small piece of ksh code for a simple task. I need to retrieve about 14 millions lines from a table and then generate a xml file using this informations. I don't have any treatement on the information, only some "IF". The problem is that for writing the file it takes about 30 minutes, and it is not acceptable fo...

Regarding UNIX Shell Script

When there is no files inside the folder the below script goes inside the for loop. Not sure what i can modify so that it doesn't go inside the for loop. Also when there is no files inside the directory exit status should be success. Wrapper script checks the exit status of the below script FILESRAW ="/exp/test1/folder" . for fspe...

Regarding Unix shell script

I want to retrieve the file from the INFILE directory which are begining with the file names prefix "BBSCGG_" or "BCT_" or "ACL_" or "ASC" and do the processing inside the for loop INFILE=/ext/test/fil1/ for infile name in file prefix ... if [[ -f ${fspec} ]] ; then processing logic else proc...

is there are nice unix command for dumping the text representation of a binary file.

Hi I got some binary files containing integers. Is there some nice unix command, that will allow me to dump it to a terminal without offset info etc? something like double int[4]; while(fread(tmp,sizeof(int),4,stdin)) for(int i=0;i<4;i++) printf("%d\t",tmp[i]); It seems that hexdump and od gives me the information I want, but t...

Is there a way to identify version of c/c++ library?

For example, how to get the version of /usr/lib/libz.a? It will be great if other useful information such as compiler/arch etc. can be fetched. The reason I want to know this is that gcc always say it ignored the libz I offered in command line when I compile my program and linked with specific versioned libz. gcc think the /usr/lib/libz...

what is wrong with this shell script

market_l="${echo $1 | awk '{print tolower($0)}'}" echo $market_l when i execute this its giving me an error below: ./test: market_l="${echo $1 | awk '{print tolower($0)}'}": The specified substitution is not valid for this command. ...

What's the best way to convert Windows/DOS files to Unix in batch?

Basically we need to change the end of line characters for a group of files. Is there a way to accomplish this with a batch file? Is there a freeware utility? ...

Renaming and Moving Files in Bash or Perl

HI, I'm completely new to Bash and StackOverflow. I need to move a set of files (all contained in the same folder) to a target folder where files with the same name could already exist. In case a specific file exists, I need to rename the file before moving it, by appending for example an incremental integer to the file name. The exte...