unix-programming

late binding in C

How can late binding can be achieved in c language? can anybody please provide an example. i think it can be achieved using dlopen and dlsym but i am not sure about it.please correct me if i am wrong! ...

Why 'x' used in [ x"$VAR" = x"VALUE" ] ?

I can see in unix shell scripts that following construction used [ x"$VAR" = x"VALUE" ] instead of [ "$VAR" = "VALUE" ] Why? ...

queque system that manages load

I need a queque system that runs as fast as possible but doesn't slow down the server. I have a web app (php) that converts different pieces of media (photos,video,etc). When someone wants to convert a file the command to convert goes into a database. I need a program that can run the commands in a way that will not crash my server. I...

use perl script on remote servers and bring back output to local terminal or screen

I have the following perl script that works locally given the input parameters. I need the script to access remote servers for the same information, given that I've already setup the ssh keys successfully. The path for the logfiles on the remote servers are identical to local. Configuration for remote servers are identical. I just need t...

What process is undertaken in UNIX when a program terminates due to software failure?

Hey guys, I'm new to UNIX, trying to teach myself and came across this practice question in the book im using. My guess is that the program terminating simply calls the exit function if an invalid input is passed to it. Please let me know if I'm on the correct path! Thanks guys! ...

sql from shell script

Hi, I have the below shell script in which sql file is called which has set of select and insert statements. Right now it's spooling output/error of the sql select /insert commands to the csv file. I want the output and error of the sql commands redirected to the shell script LOGFILE instead of spool file. How can i do it. LOGPATH=${...

unix shell programming special variables

I need a good reference on unix shell special variables (csh, ksh and bash). e.g. $1, $*, $#, etc. ...

How do I package my unix builds as a Mac .pkg installer

So I built my ruby 1.9, mysql, postgres, lighttpd, gems and other libs now I want to make it as package to install on other machines. Just how do I do this with Apple PackagerMaker and have it install in the right folders on the machine. I want to get it done soon to install on all the lab computers. ...

unix : A simple c-program to implement saved-set user id

How to implement saved-set user id using C language? ...

Reload .profile in bash shell script (in unix)?

Hi all, I'm new to bash shell scripting, and have come across a challenge. I know I can reload my ".profile" file by just doing: . .profile but I'm trying to the same in a bash script I'm writing and it is just not working. Any ideas? Anything else I can provide to clarify? Thanks ...

Issue with softlink

I deleted symbolic link which was pointing to x binary, recreated a same link pointing to y binary i.e. now it’s pointing to y binary instead of x binary. When I am running binary from its location it’s giving correct result. Let say the binary is at location $/tmp/value>./y Output is correct If I go to another directory, /abd/def>...

thread safe path comparison or canonicalization function for Unix?

I'd seen some ancient code that simplifed Unix paths for comparison by doing something like the following pseudocode: strip off the last path component to get a directory only part: /foo/bar -> /foo getcwd and remember original path chdir /foo getcwd and remember to return to caller chdir old original path Is there a standard Unix sy...

fastest hashing in a unix environment?

Hi, I need to examine the output of a certain script 1000s of times on a unix platform and check if any of it has changed from before. I've been doing this: (script_stuff) | md5sum and storing this value. I actually don't really need "md5", JUST a simple hash function which I can compare against a stored value to see if its changed....

Combining tab delimited files based on a column value

Suppose I have two tab-delimited files that share a column. Both files have a header line that gives a label to each column. What's an easy way to take the union of the two tables, i.e. take the columns from A and B, but do so according to the value of column K? for example, table A might be: employee_id name 123 john 124 mary a...

String to Date conversion for UNIX?

I have string 2010-07-26 18:37:12 and I want to convert it to date format so that I can compare it with other strings and check whether date (2010-07-26 18:37:12) is earlier or not. Could anyone suggest way to convert this string to date? ...

How can I insert a column in numeric comma separated input?

Hi i have as text file below input 326783,326784,402 326783,0326784,402 503534,503535,403 503534,0503535,403 429759,429758,404 429759,0429758,404 409626,409627,405 409626,0409627,405 369917,369916,402 369917,0369916,403 i want to convert it like below condition : 1)input file column 3 and column 1 should be be same for 326784 a...

ASN1 CDR format to CSV

Hi all I want to to convert ASN1 CDR format to readable CSV Can anybody help me how to do it in UNIX language ...

Regarding access time unix

I want to know what is access time . searched in web but get the same definition (read- gets changed). I know with touch we can change it. Could any one explain me more about it with an example how it is changed. Also is there any way file creating date/time be found in unix? ...

gettimeofday(). is it agnostic for change in day light saving time?

if the system time changes for day light saving time, does the output of gettimeofday() is changed? ...

how to understand the output of time command

How to understand the output of time command. I am trying to figure out the performance of my code. But I do not understand the output of time command, Can anybody please explain what does time command output means. following is what I get time ./filereader real 0m0.193s user 0m0.012s sys 0m0.056s What is 'real', 'user','sy...