unix

Trying to use execvp() in C with user input in unix

I'm trying to make a program that will prompt the user for a command, then use exec to execute that command. For instance if they gave me "ls -la" I would have to execute that command. I've tried the following code: #include <stdio.h> #include <unistd.h> #include <string.h> int main() { int ret, num_args; printf("Enter numbe...

how to read each line from a .dat file in unix?

hi trade.dat is my file which consists of lines of data. i have to concatanate each line of that file with comma (,) help me please ...

Bash Scripting - How to set the group that new files will be created with?

I'm doing a bash shell script and I want to change the default group that new files are created as. I know you use umask to change the permissions. Is there something for the group? ...

Default permissions of /dev on Mac OS X 10.5.*

Hi There, Simple question. After a little bit of 'chmod' shenanigans, I have set the permissions for all pseudo ttys in /dev to a+rw which is somewhat open. Now that I have fixed the problem that I had, I want to revert my permissions back to the correct value. Therefore, what are the correct permissions. Executing: sudo ls -la /dev/tt...

Unix: Regex and Wildcards

The reply in my post states that pattern "*@he.com" is not a "correct regexp". Actually, it is not a regex at all, rather wildcard, things like: find . -iname ".gi*" The above example in Regex would be find . -iname "\.gi.*" Questions about Regex and Wildcards How can I use only Regex instead of wildcards? Where do you really n...

Conditional sections in AIX Makefiles

How do I make a makefile that works on AIX, Linux and SunOS and has the ability to provide different compiler options for each environment? I have access to an environment variable which describes the OS, but the AIX make utility does not like ifeq, so I can't do something like: ifeq($(OS), AIX) CFLAGS = $(CFLAGS) <IBM compiler opt...

how to transfer required files from ftp server to local unix server?

Hi i have to transfer files whose names consists of two variables X, Y and they are in the directory ABC in ftp server to my local unix directory XYZ. after transfering files i have to go to local directory path and i should untar (input files are compressed files) them. one more thing i have to use username and pwd for connecting to ft...

Parse numeric ifconfig flags

The ifconfig command outputs its flags in both textual and numeric format. While I can find a reference here or there to the numeric flags, I cannot find any indication on how to interpret (mask) the number. qfe2: flags=1100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4> mtu 1500 index 4 usesrc vni0 inet 1.2.3.4 netmask ffffff00 b...

Using date to append filename to database backups made by cron

Hello, The title says it all. I want to maintain multiple dated backups via cron but I can't seem to figure out how to concatenate the file name in cron. Currently I just use the following: /bin/mv /var/www/vhosts/mysite.org/dbBackups/today.sql /var/www/vhosts/mysite.org/dbBackups/yesterday.sql /usr/bin/mysqldump --add-drop-table -...

What is the best windows equivalent for /tmp ?

I want to improve the cross platform behavior of a java application. However, its test suite currently assumes the existence of the /tmp directory. What is the best equivalent location on the windows platform? N.B. I most definitely do not want to assume the user has admin rights but I do want it to work on at least XP, Vista & Windows7...

Script to recursively delete CVS directory on server

So far I've come up with this: find . -name 'CVS' -type d -exec rm -rf {} \; It's worked locally thus far, can anyone see any potential issues? I want this to basically recursively delete 'CVS' directories accidently uploaded on to a server. Also, how can I make it a script in which I can specify a directory to clean up? ...

Script to recursively look for a file on ftp server until it found

I just want to transfer a file from ftp server to unix folder, --this is stright forward. if the file doesn't exist on the ftp server, then the script needs to run recursively until it finds the file. Please let me know how do i get that file. please remember script has to run on ftp server. Thanks CK ...

Is there free ERD tool mysql in unix suse 8?

Hi guys, i have an older test unix server with mysql 4.1 enterprise edition on it. i'm looking for a tool that i can use to automatically generate an erd? preferably free and easy to setup... i try to install workbench but i didn't have the know how and after checking with my server guys he told me that i can't install the latest versio...

how to get quotes in output in unix?

abc.dat file contains lines 1 2 3 code is tradeline="" for line in $(cat abc.dat) do tradeline="$line,$tradeline" done sample output am getting is 1,2,3, but i want the output as "1","2","3", can u help me plz ...

Is there any er diagram tool in Windows that I can use to connect to a MySQL 4.1 database in Unix?

I have a few test databases in some Unix SUSE 8 servers and initially the plan was to find some tools which can directly create the ERD straight from the server until someone told me that I can find tools to connect from the Windows PC straight to the Unix MySQL database. So I saw MySQL query analyzer which can do this but unfortunately...

How to run .jar file on unix ?

I have generated .jar file in windows. I have to execute that .jar file in unix . I am running that command (java -jar myJar.jar), but it's giving java.lang.UnsupportedVersionError I am using java version 1.5.0.12 in Unix. ...

How can dereferencing a NULL pointer in C not crash a program?

I need help of a real C guru to analyze a crash in my code. Not for fixing the crash; I can easily fix it, but before doing so I'd like to understand how this crash is even possible, as it seems totally impossible to me. This crash only happens on a customer machine and I cannot reproduce it locally (so I cannot step through the code us...

Confused by output using xargs

I have these files in a directory: y y1 y2 y3 Running this command: ls y* | xargs -i basename {}|xargs -i sed "s/{}//g" produces this: 1 2 3 Can someone explain why?! I expected it to produce nothing - running sed four times, once for each file, and removing the file name each time. But actually it looks like it's applying sed w...

process is failing in ptrgl_64._ptrgl functionon aix

We are trying to port our code from HPX to AIX but getting core dump while running exe. its failing in some unknown function ptrgl_64._ptrgl. > ptrgl_64._ptrgl() at 0x900000084da0e48 > dfile_Proc(o_record = > 0x0000000400000004, fileType = > "^O\377\377\377\377\377TH^O\377\377\377\377\377TQ^O\377\377\377\377\377Ta^O\377\377\377\377\377...

Unix: seeing file handles like with "lsof -l"

I did the commands (source): $ exec 3>/tmp/thirdfile $ exec 4>/tmp/fourthfile $ echo drib >&3 $ echo drab >&4 $ echo another drib >&3 $ echo another drab >&4 $ exec 3>&- $ exec 4>&- How can I see the file handles, something like with "lsof -l"? ...