unix

Prevent child process from system calls

I want to create a child process that call another program (with C++ in Unix). But I want to restrict the child process not to call system(), fopen(), etc. (if it did, it would be terminated). How to do that? ...

Characters not making it from a master to a slave pseudo-terminal

Hello, I am currently trying to send binary data out through pexpect. For some reason, the data gets through just find except for a 0x04, which is just skipped over. I tracked down the pexpect call to determine that all thats happening is an os.write() call to a file descriptor opened from a pty.fork() command. Any ideas? (example...

How to echo text and have output from a command be sent to a file in parallel

I would like to echo text and also remotely ping a computer and have the output be sent to a log file. I also need to do this in parallel but I am having some trouble with how the output is being sent into the log file. I would like the output to look like: host | hostTo | result of ping command but since I have this running as a back...

What does '-a' do in Unix Shell scripting

What does -a mean in the below line. if [ "${FILE_SYSTEM}" != "xyz" -a "${FILE_SYSTEM}" != "abc" ] ...

Pick up particular set of lines from a file...

Input file format: <Tariff> <AA>10030</AA> <AA>100</AA> </Tariff> <Tariff> <AA>30004</AA> <AA>30001</AA> </Tariff> <Tariff> <AA>Account division</AA> <AA>AIR</AA> <AA>AA</AA> <AA>10039</AA> </Tariff> Output format : Output should be aligned in a manner of Open Tag of "<Tariff>" & Having End Tag of "<\Tariff>" also separated by comma s...

How to convert rows to columns and vice versa

hi cat > input 0,4880,1;1,8877,1;2,LT33A,0;3,2224,1;4,4926,1; Output should be like below 0,4880,1 1,8877,1 2,LT33A,0 3,2224,1 4,4926,1 can anybody help me out ...

Java program stdout and detaching from foreground

Hi, I have a java program, let's say Test.class. When I execute java Test the program ask for a Password and then continute. The problem is that the stdout is redirected to a log and the program is launched with the & ( we are on UNIX). How can i interact with this program launched java Test & with the stdin and stdout? One possible...

Pick up particular fields in an xml file

Need to be done : Actually i want to pick up the fields above the Lines ends with "ExitTreeModifier " and so on... File Contain many "" & "<\Node> in Inline, But i want to pick up like this i/p file: 1 . . . . ExitTreeModifier 11 . . . . ExitTreeModifier 15 . . . . ExitTreeModifier o/p file: ,1,.,.,.,.,ExitTreeModifier...

how to use unix libraries in visual studio 2008

I have c code that is using unix libraries and in linking ihave the following error: error LNK2019: unresolved external symbol "double _cdecl dlamch(char *)" (?dlamch_@@YANPAD@Z) referenced in function "double __cdecl Num_dlamch_primme(char *)" (?Num_dlamch_primme@@YANPAD@Z) s iwant away to use the unix libraries in visual studio 2008...

avp.com scan pipe error when using ssh -n command ?

i have the following case :- i design :- 1- file.bat on windows 2003 2- file2.sh on unix-aix file2.bash call file.bat and file.bat receve path from file2.bash and file.bash return a value to file2.bat .... when i execute this from my servers all thing good but when i call this from my website (PHP) the following error appear :- ER...

how to run quota in UNIX ?

Hi, I am using ubuntu in my machine and wanting to run the command quota -v. So, I install quota by typing in sudo apt-get install quota. When I type in quota -v, it doesn't show any information. only commands that works is quota -h and quota -V. could you please tell me if I have to anything else to make quota -v to work? Thanks a lot....

get exact argument list of a process using ps

I am writing a session saver for GNU Screen. It needs to get every process argument list. Linux has /proc/PID/cmdline which separates arguments with \0. Solaris has pargs. But I am looking for a more crossplatform solution and ps tool seems to be the best bet. "ps -o command" displays argument list but separates arguments only with space...

How do I close a file that I created using cat > command?

I learning how to use git on a Mac and I'm trying to add a file in one of my branches by using the "cat > " command. The problem I'm having is that I want to end editing the file in the terminal but I do not know how to close it. I'm guessing that I need to change "modes" for lack of a better term. How do I proceed? ...

TERM environment variable not set on mac

I keep on getting the "TERM environment variable not set." error when I work with svn commands on my Mac terminal. I thought I had set up my profile by doing: export SVN_EDITOR=/usr/bin/nano export EDITOR=/usr/bin/nano in .profile and .bash_profile, reset the terminal and it still gives me that error. Any help? ...

Cannot send character with minicom

Hi all, I'm using minicom to connect through a serial link to a target (UART link of a sparc processor). With gtkterm or cutecom, I can connect, read and send characters. The only issue with them is that they both insert empty lines after each LF character, and : -gtkterm cannot record output to a file -cutecom does not "flush" after r...

Problem with run commands in shell (bash) with arguments as variables !

Hi all ! (Sorry for the confusion. Previous $ sign occurred when I tried to simplify the actual problem. Thanks for correcting the question) I wanted to split a directory name on underscores (ex: dir_to_split="my_test_dir") like this: my_dir=($dir_to_split) var=$(echo $my_dir | awk -F"_" '{print $1,$2,$3}') set -- $var splited_1=...

Unix - Nested Loop. One loop to untar then another to inspect each file in directory

I'm trying to loop round a load of tar files and then move the extracted files into a new folder, inspect them and delete them before moving onto the next tar. Code is below: for i in * do tar -zxvf $i mv *TTF* encoded cd encoded for j in * do echo $j done rm -f *TTF* cd .. done When it gets to the nested loop, ...

Ignoring the forward slash in a shell script

Hello wonderful computing persons, This is really simple and I hope I'm not being redundant. I'm writing a shell script with this command: sed -e 's/OLD_ITEM/NEW_ITEM/g' but I actually want to do something that includes a directory: sed -e 's/FOLDER/OLD_ITEM/NEW_ITEM/g' how do ignore the forward slash so that the entire line FO...

Run a shell script on all files within a directory and its sub-directories

Good evening fellow computational authors, I'm trying to run the following script: find . -name '*.php' -exec /search_replace.sh {} \; so that it runs search_replace.sh on all the .php files in a folder and its sub-folders. I keep on getting the error: find: /search_replace.sh: No such file or directory Any assistance? ...

How can I find the Unix process that owns a local Sleeping MySQL connection?

I'm fighting a 'Too many connections' problem with my MySQL process and I've got to the point when mysqladmin processlist -uroot -pXXXXX results in: +------+------------+-----------+------------+---------+------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +------...