Programming :: How To Use Bashrc To Redirect Executable Call?
May 24, 2011
I need to redirect a /usr/sbin/sendmail command to $HOME/bin/msmtp .The sendmail command would be coming from a PHP5 application. I'm assuming the best way is to use .bashrc, but .htaccess is also available.The remote server is a shared web host which is running Debian 4.0.I do not have root access.I have SSH access.
View 2 Replies
ADVERTISEMENT
Jan 8, 2010
i have only basic knowledge of C so guys plz help me...is C language support call the C executable inside the C ?example contect mainA.c have a many function define in the struct,when i compile mainA and make a executable the name is ( A ),can i use executable C inside the C <my C program call the executable ( A ) > .
View 9 Replies
View Related
Jun 1, 2010
I have created a executable file using c and I have also created a GUI using GTK+. Now how can I call the executable file from the GUI with arguments passing to the executable file.
View 4 Replies
View Related
Mar 9, 2011
I am trying to grep multiple numbers from file, grep does have the -f option for that.
Code: grep -f <`seq 500 520` /etc/passwd I know this could be done with
Code: for i in `seq 500 520`; do grep "$i" /etc/passwd; done But my question is fare more behind this example. It is possible to redirect one command output which will be treat as a content of file for another command ?
View 2 Replies
View Related
Jul 5, 2010
I tried to make a (very simple) function to put in my .bashrc file to make a local backup of a file, but when I call the function and try to use tab completion I get the following error: Code: cp: cannot stat `help': No such file or directory The function I added is as follows:
Code: function bk
{
cp -f --backup=numbered ${1} ${1}.bak
[code]....
View 2 Replies
View Related
Jun 14, 2011
When I add some path in .bashrc by commenting out old path and adding new one like this:
#EXPORT HOME_PLAY=/home/gem/old_play
EXPORT HOME_PLAY=/home/gem/play
EXPORT PATH=$PATH:HOME_PLAY
After saving above changes, I enter the command: source ~/.bashrc Now if I do echo $PATH, the path shows both the old PLAY_HOME and new PLAY_HOME. This is really bad and messes up a lot of things in my project. This problem only goes away if I logout or reboot, a rather very long process. What is happening is that the old path is added to new path element and the old path includes the old path element you want to remove.
View 10 Replies
View Related
Jun 2, 2010
I want to find the cpu time taken by an executable to run.. the executable is writting the output to a file. i want to write the time takem by cpu to the same output file.
like:
abc is my executable which is taking input as input file and writing the result in output file.. i want to append cpu time information in the same file. can i do it with time command?
View 5 Replies
View Related
Feb 23, 2009
I was wondering if there was a way to add a switch to a gcc/g++ call everytime. I have a few libraries that I need to compile for different processors. Each has a makefile which calls gcc to compile. Here is the best option I could come up with so far:Include a Makefile and define CC as gcc -mcpu=xxx.
View 4 Replies
View Related
Apr 20, 2010
Does unistd.h declare functions in the kernel or in the stdclib? Or in any other C file. I need to know from the inside how some of the functions work.
So where does unistd redirect to?
View 4 Replies
View Related
Apr 17, 2011
I have written C++ programs on Windows. I am now learning Linux to ensure my software is portable. I can compile and run C++ programs from the bash shell, but I cannot run my executable programs from the GUI.Here is my sample program:
Code: #include <iostream>
int main()
{
[code]...
View 3 Replies
View Related
Jan 13, 2010
I'm maintaining a c++ application running on a 64-bit RHEL5 server w/32GB ram, but compiled to be a 32-bit executable with g++. The application handles large amounts of data, and has lately been throwing a st9bad_alloc exception. "top" shows the application as dieing right around when VIRT=~3GB, SWAP=~1.5GB and RES=~1.5GB. In the core dump I can see that it's consistently failing to push_back() a piece of data onto a std::vector (which already has hundreds of thousands of objects in it).
I know 4GB is the maximum address space for 32-bit applications. I've learned from this lwn article that a 32-bit kernel reserves 1GB of address space, leaving 3GB for user space. However I'm not running a 32-bit kernel, so that really doesn't answer anything.I wrote a dummy app which called malloc() over and over in a for loop, and it is able to allocate right up to the 4GB before it fails. I don't understand why this one seems to be able to allocate more.
The only difference between the two apps (besides malloc vs std::vector:ush_back), is that the 3GB crashing application attaches to 512mb of shared memory.Anyone have any ideas why this application would be crashing at 3GB? Is there any more diagnostics I should be doing? I would ultimately like to port this to 64-bit for a number of reasons, but it is a big undertaking for my organization, and I'd like to better understand what's going on here.
View 3 Replies
View Related
May 5, 2009
It is possible to run multiple instances of a jar executable. Is it possible that only a single instance of the jar runs? Wrappers like JSmooth or Launch4J can be made to run as a single instance. But since there are no such wrappers for linux, I need a way to restrict the jar to a single instance. How to embed the jar file into an executable such it runs a single instance?
View 14 Replies
View Related
Mar 2, 2010
when compiling a c++ program in g++ on Linux, how can I add version information to that executable and if possible is there a Linux utility to read the version information?
View 2 Replies
View Related
Apr 3, 2011
in below program why was new_args[0], rather than the reference the_cmd, passed to the execvp system call?
Code:
/*
A _very_ limited shell program
[code]....
View 2 Replies
View Related
Sep 29, 2010
There are examples everywhere about calling f77 subroutine from IDL, but I have not found any material about IDL calling fortran written in f90 way(free style). I tried the following example, but write the subroutines in free style. When I run the makefile, it gives an error 'undefined reference to main_'.
Code:
SUBROUTINE SUM_ARRAY(argc, argv) !Called by IDL
INTEGER*4 argc, argv(*) !Argc and Argv are integers
j = LOC(argc) !Obtains the number of arguments (argc)
[code]....
View 1 Replies
View Related
Jun 4, 2010
My hardware is the FriendlyArm mini2440 Samsung board. I run our main application from init.d/rcS. It uses printf's to display continuous program debug information that can be seen on the serial ttySAC2 console. I would like to be able to remotely view this information by a telnet connection when needed. What is the best way to accomplish this? The telnet user can possibly activate some script or program. I saw there is a ttysnoop program that I could not get to compile.
There must be a simpler way. There must be several ways. Instead of using printf I could do something else. I do not want to use a normal log file to the flash file system. I had thought of using a ram file in /var directory but it would complicate matters as I would need to limit its size and the telnet user needs to view the program's printfs in a real time fashion.
View 1 Replies
View Related
Aug 6, 2010
I am again struggling to make a script work, but hey, it is fun, I am learning new things. I discovered the set -x option which was, for me, like the second coming. Still, what I am not able to do is redirect ALL output to a (log) file, including what is produced by the -x setting. Let's assume a very simple script:
Code: #!/bin/bash
set -x
source="/home/atelier/Bureau/"
ls -la $source and I am running it as . test.sh >> /var/log/test.rmcb.log
The result of ls goes inded into the log file, but the rest still shows on the console where I am running the script: Code: ++ source=/home/atelier/Bureau/
++ ls --color=auto -la /home/atelier/Bureau/ Is there a way to redirect EVERYTHING to the log file ?
View 3 Replies
View Related
Nov 12, 2010
I feel kind of embarrassed posting here, but this is technically a scripting sub-forum. Here is the problem. I have a folder with various files which include .txt files as well
How can i redirect same content to each of the .txt files in the folder?
I have tried
Code: $ echo "hello" > *.txt
-bash: !": event not found Code: also cat ~/otherdir/test.txt > *.txt
-bash: *.txt: ambiguous redirect Can anyone help me with this?Ok i solved it
Code: #! /bin/bash
for file in *.txt
do
echo "Text that needs to be written" > $file
done
View 2 Replies
View Related
Jun 12, 2011
I have this code in PHP that is hosted on an nginx server.
Code:
I can download the files but the problem is I think nginx is treating it as a text file and changes all "0x0A" to "0x0D 0x0A"
Unfortunately the files are not text files but executable files which makes the downloaded file corrupted.
Do I need to add a specific header to prevent this from happening?
View 1 Replies
View Related
Nov 29, 2010
In practice I have a script that call a java program that call a linux system command. The script if I run it, from a shell functions well,so it is not a java problem. The problem come out when i put this script in a crontab schedulation. The result in this case is that java do not execute the system command. I think it depends on crontab
View 4 Replies
View Related
Sep 3, 2010
I am trying to run Wattch simulator in linux.But it is giving the error below. what is this error and what do I do about it?
fatal: bad magic number in executable `prime' (not an executable?)
View 1 Replies
View Related
Oct 4, 2010
I am trying to use a software package written in ANSI C. It has a makefile which has to be executed first.
As soon as I execute it I get messages like: line i: command not found.
Commands for which I am getting errors :
CC = /usr/bin/gcc
GCCFLAGS = -c -Wall
ROOTDIR = .
My gcc compiler is located in the above directory only. In ROOTDIR also I tried giving the path in which all the required files & folders are present but still I get the command not found error in all the lines.
View 7 Replies
View Related
Apr 4, 2011
I wrote a c++ program but for security reasons I need to make sure that no one can read my codes by my ".out" files. I did everything I could. But everyone can see it by "strings Alpha.cpp".I heard that g++ has some options to do so.
View 7 Replies
View Related
Jun 30, 2011
Since I read that executing a library could return its version number, I ran "/lib/libc.so.0" on uClinux, but it triggers an error.I'm told that random libraries are not directly executable. Does someone know what a random library is?PS: In case that matters, here's the short version of the error:
Code:
Undefined instruction
<5> - May be used to emulate instructions that are not defined for
[code]....
View 2 Replies
View Related
Oct 8, 2010
I am facing issue in my OPENSSL code. I have written openssl client. It sends request to the host and receives response for that request.
My problem is, it connects, sends request successfully to host at first time only in sencond attempt it fails on SSL_write(). where SSL_get_error() returns SSL_ERROR_SYSCALL error.
In that ERR_get_error() returns 0. man page shows "If ret == 0, an EOF was observed that violates the protocol".
Code Snippet.
w=SSL_write(SSLRequestData.ssl,c2s,c2sl);
switch(SSL_get_error(SSLRequestData.ssl,w))
{
case SSL_ERROR_NONE:
if(c2sl!=w)
[Code]....
View 3 Replies
View Related
Dec 8, 2010
I have a process that forks, where the childs puts some data of random size and exits while the parent should get the data and does some manipulation.. here I have used a pipe for child to write the data and parent to read the data.. Child simply dumps the data, and the data is of any size even child and parent doesnt know.
I have used select in the parent to see whether there is any data coming on the reading end of the pipe.. if there is a data.. I copy into a buffer.. Im reading the data continusly when the child exits after closing the writing end of pipe. Parent gets blocked on the read part But my question is how parent know the other of pipe is closed when using the select call. In otherwords.. while using select in readfds, how would i know the other end has closed the pipe..
View 2 Replies
View Related
Sep 18, 2010
I am trying to figure out how i would go about finding out where system call is made and error checking is not done. I have code below, if somebody can point me in the right direction where system call is made but error checking is not done.Quote:
#include "shell.h"
#include <stdio.h>
#include <string.h>
[code]....
View 5 Replies
View Related
Sep 4, 2010
i used ldap for authentication.now i have a perl script that users use it for login(contact.pl),then this script calls a shell script(ip.sh) for create iptables chain.
when i call that into contact.pl ,it just prints: usr/sbin/iptables but ip chains didn't change.what is problem? whenever run ip.sh in bash it works correctly
View 10 Replies
View Related
Jul 20, 2011
I have a script which takes an array as an input to the file.ex: test.ksh -l <array_value>
Every time I dont get the same array name.EX: test.ksh -l x ; where x="a b"test.ksh -l y ; where y="c d"
I store the value I get in l in varaible myLvalue.Now indise my Script I want to run a for loop for thevalue I get in -l.If I write the for loop as below. I'm getting value x.However I'm expecting the loop to run for a and b.
View 5 Replies
View Related
Aug 30, 2010
I successfully added a new system call in CentOS Kernel but I don't know where to view it! My kernel version is -2.6.32.5
View 2 Replies
View Related