unix

Why does fprintf start printing out of order or not at all?

This code should take an integer, create pipes, spawn two children, wait until they are dead, and start all over again. However, around the third time around the loop I lose my prompt to enter a number and it no longer prints the number I've entered. Any ideas? #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno...

Using Regex groups in bash

Greetings, I've got a directory with a list of pdfs in it: file1.pdf, file2.pdf, morestuff.pdf ... etc. I want to convert these pdfs to pngs, ie file1.png, file2.png, morestuff.png ... etc. The basic command is, convert from to, But I'm having trouble getting convert to rename to the same file name. The obvious 'I wish it work...

New Application Process from Bash Shell

I'm relearning UNIX commands to use git on windows using MINGW32. When I launch a program, for example "$ notepad hello.txt" I can't use the shell again until I close the notepad file or CTRL-C in the shell. How do I essentially fork a new process so I can use both programs? ...

UNIX Executable File

Hi, I got some file sample.mt from client, and when i open info, it reveals as UNIX Executable file. But, actually when i replaced the extension with zip, i could extract the file content. And it appears to be folder. Can any one say what exactly UNIX Executable file means and how is it created. By the way, that is created in Wind...

What pixel format does X server use?

What pixel format (RGBA, ARBG, BGRA) does the X server use? If any specific format at all. Update: I'm specifically looking for information about the color component order and bit patterns. ...

UNIX sort: Sorting something from the clipboard

The other day I saw a colleague of mine using sort to sort a number of lines he copied from a text file. I've been trying to reproduce it myself and I cannot seem to find how. The requirements are as follow: Use sort from command line, plus whatever else you need to add to configure input Paste the text to be sorted from the clipboar...

Determine files modified by process

I'm writing a program to be run from the Linux user space which spawns another process. How can it determine which files were modified by the spawned process after it completes? ...

Why doesn't strace catch all file accesses?

I'm trying to use strace to monitor all file accesses by g++ but it only seems to catch read accesses. Why isn't the file access for the output file shown? ...

Why is the value of this string, in a bash script, being executing?

Hello Why is this script executing the string in the if statement: #!/bin/bash FILES="*" STRING='' for f in $FILES do if ["$STRING" = ""] then echo first STRING='hello' else STRING="$STRING hello" fi done echo $STRING when run it with sh script.sh outputs: first lesscd.sh: line 7: [hello: command not found le...

Unix shell script with Iseries command

I am trying to ftp a file from unix to as400 and executing iseries command in the script. ftp is working fine,I am getting an error in jobd command as HOST=KCBNSXDD.svr.us.bank.net USER=test PASS=1234 #This is the password for the FTP user. ftp -env $HOST << EOF # Call 2. Here the login credentials are suppli...

How to (legitimately) access files after putting self into chrooted sandbox?

Changing a Linux C++ program which gives the user limited file access. Thus the program chroots itself to a sandbox with the files the user can get at. All worked well. Now, however, the program needs to access some files for its own needs (not the user's) but they are outside the sandbox. I know chroot allows access to files opened ...

[UNIX] Is it safe to pipe the output of several parallel processes to one file using >> ?

I'm scraping data from the web, and I have several processes of my scraper running in parallel. I want the output of each of these processes to end up in the same file. As long as lines of text remain intact, I the order of the lines does not matter. In UNIX, can I just pipe the output of each process to the same file using the >> ope...

How can UNIX access control create compromise problems?

My system administrators advice me to be careful when setting access control to files and directories. He gave me an example and I got confused, here it is: a file with protection mode 644 (octal) contained in a directory with protection mode 730. so it means: File: 110 100 100 (owner, group, other: rw- r-- r--) Directory: 111 011 00...

How to delete columns?

Hi all, I have generated the following text file below: fe120b99164f151b28bf86afa6389b22 -rw-r--r-- 1 joey joey 186 2010-03-14 19:26 Descript.txt 41705ea936cfc653f273b5454c1cdde6 -rw-r--r-- 1 joey joey 30 2010-03-14 20:29 listof.txt 0e25cca3222d32fff43563465af03340 -rw-r--r-- 1 joey joey 28 2010-03-14 23:35 sedexample.txt d41d8cd98f0...

I SVN updated, but I realize I messed up.

How do I rollback to a previous revision? So that my files are back to revision 400? ...

Same memory space being allocated again & again

In each loop iteration, variable j is declared again and again. Then why is its address remaining same? Shouldn't it be given some random address each time? Is this compiler dependent? #include<stdio.h> #include<malloc.h> int main() { int i=3; while (i--) { int j; printf("%p\n", &j); } ...

can dbxtool run more than one instance under the same user account?

At work we tend to all use the same useraccount on a development system - this means we can only have one instance of dbxtool running at a time! If you run as a different user then you are unable to attach to running processes that belong to the main user account. Apart from habitually running dbxtool as root, is there a way to force m...

Bash: using commands as parameters (specifically cd, dirname and find)

This command and output: % find . -name file.xml 2> /dev/null ./a/d/file.xml % So this command and output: % dirname `find . -name file.xml 2> /dev/null` ./a/d % So you would expect that this command: % cd `dirname `find . -name file.xml 2> /dev/null`` Would change the current directory to ./a/d. Strangely this does not work. ...

Insert copyright message into multiple files

How would you insert a copyright message at the very top of every file? ...

Howto Pass A String as Parameter in AWK within Bash Script

I have a text file which I want to filter using awk. The text file looks like this: foo 1 bar 2 bar 0.3 bar 100 qux 1033 I want to filter those files with awk inside a bash script. #!/bin/bash #input file input=myfile.txt # I need to pass this as parameter # cos later I want to make it more general like # coltype=$1 col1type="foo" ...