Programming :: Calling Bash Script In Php?

Jul 17, 2010

I have a bash script that changes the iptables.Now i call this bash script in my php code.When this bash script is running the part of code that contains iptables instruction is not running because we need to be in superuser mode(root)

View 14 Replies


ADVERTISEMENT

Programming :: Bash - Calling A Specific Variable Based On User Input?

May 3, 2011

I'm trying to call a specific variable based on a user selection. For example:

Code: Select a file:

[1] foo.tar
[2] bar.tar

Enter a selection: I have already coded each possible selection to have its own variable. If the user selects 2 I need to select $SELECTED_TAR2, or if they select 1 I need to select $SELECTED_TAR1 and then do something like this behind the scenes:

Code: cp /home/user/$SELECTED_TAR2 /home/user/backup/$SELECTED_TAR2

I was thinking something like this:

Code: echo "Enter a selection: "
read -e SELECTED_NUMBER
cp /home/user/$SELECTED_TAR$SELECTED_NUMBER /home/user/backup

[code]....

View 2 Replies View Related

Programming :: Calling Bash Script With More Than One Variable From Python Script?

Oct 4, 2010

I am calling a bash shell script from a python script trying to pass several arguments to the bash script with no succes can this be done? I have researched (google) with no clear indication of how to achieve this. Using "os.system"

View 4 Replies View Related

Ubuntu :: Calling Firefox Macros From Bash?

Nov 27, 2010

I would like to call some firefox macros from bash so that I can manipulate them in some scripts. Does anyone know how to do that?Currently I'm using the imacros firefox add-in

View 1 Replies View Related

Ubuntu :: BASH Quote - Calling Commands Stored In A Variable?

Feb 19, 2010

I am having some weird problems with calling commands stored in a variable (I need to do this to assemble a command with a bunch of parameters automatically and then execute it).Example code that will replicate the weirdness:

$ echo "hello world" > "test file.txt"
$ cat "test file.txt"
hello world

[code]....

I would expect the output to be:

hello world

What happens to the quotes? I have tried various combinations of single quotes, escaped quotes, etc, but it seems like quotes in a variable are not evaluated as quotes when that variable is executed.

View 9 Replies View Related

Software :: Bash Script Calling Make Files With CFLAGS Prepended?

Feb 6, 2010

Most all of this works when I execute it manually, but I cannot figure out how to get a bash script to execute it automatically.In this particular case, I am trying to build the xorg utilities. If I manually step through the process, prepending the commands with CFLAGS, LDFLAGS, etc, all of the packages build.So I created a bash script, test.sh:

Code:
#!/bin/bash
export INITFS=/initfs

[code]...

View 5 Replies View Related

Programming :: Calling An Asm Function From C?

Jun 4, 2010

I have a question about calling an asm function from C....It doesn't work unless I create an asm variable to hold the value of the function in....Why?Here's the code that doesn't work...

asmfile.s - version one Code: .section .data
mydata: .ascii "this is the message!
.equ mylen, . - mydata

[code]...

View 2 Replies View Related

Programming :: Calling C Function In Php?

Feb 7, 2011

I am doing a web site program and what I need is to call a C program in the PHP cloud.Do u think it would be possible? The web site would get the user input from PHP UI and pass to the C program , the C program would process the function with the user input and output the a PHP page.

View 2 Replies View Related

Programming :: Calling C Ece From Java Source

Aug 13, 2010

I want to call c exe from java source code and i want to interact with the c program during it's execution, i am able to send the parameters to c program but i am not able to interact with it.

View 3 Replies View Related

Programming :: Tty Is Closed Without Calling Close(?)

Feb 17, 2011

I have found a weird behaviour on a linux application. A tty seems to get closed without calling close. The program is (very simplified) as follows:

Process 1:
configure_signals()
read_config_files()
create_threads()
wait(forever)

Thread 1:
fd=open(/dev/ttyXX)
usleep(a while)
config(fd)

I have spent quite a lot of time on this problem. It seems like the file is sometimes closed when reaching config(fd), but removing the usleep(a while) seems to remove the problem.

View 1 Replies View Related

Programming :: Calling Fortran 95 Code In C?

Apr 15, 2009

I'm trying to call some Fortran 95 code in C, but I'm having problems with integers not having the same value in C as in Fortran, and changing values upon each run of the program. I think it has to do with the integer type, but I don't know how to fix it. I'm running Gentoo x86. Here are the files I've got:

foo.c:

Code:

#include <stdio.h>
extern int qux_();
main() {

[code]....

View 2 Replies View Related

Programming :: Calling Subroutine In Perl

Aug 19, 2010

What is the difference in perl between:

'function();'

and

'&function();'

with and without ampersand.

View 1 Replies View Related

Programming :: Use The Sockaddr_in Like Before Calling Bind()

Jul 30, 2011

i use the sockaddr_in like this before calling bind(), it works good.

Code:
sockaddr_in serveraddr;
serveraddr.sin_port=htons(5000);
serveraddr.sin_addr.s_addr=htonl(INADDR_ANY);
serveraddr.sin_family=AF_INET;

[Code]....

View 2 Replies View Related

Programming :: Calling A System Command In Perl?

May 20, 2010

I'm trying to call a system command in perl and am having an issue with it.

Here's an example of a command i'd like to call: Code: sed -i '4 c192.168.1.4 www.something.com' hosts this is the section in my perl script where I create the variable and call it: Code: $doit = `sed -i '$line c$ip $host hosts'`system($doit); The $line, $ip, and $host variables are working fine becasue I can replace that section with "prints" and they come out fine. I imagine the problem is where I am creating the $doit variable.

View 7 Replies View Related

Programming :: Calling Routines In Fortran Modules From C++?

Jan 21, 2011

I want to call a subroutine in Fortran 90 from a c++ code. I can do it, when the fortran code have no module. But i need to call the subroutine in a fortran code that have an module. I have a simple program that shows my problem. The Fortran code is:

Code: !add2.f90
Module add2
Implicit none
Contains

[code]....

collect2: ld returned 1 exit status I Dont know where is the problem. Maybe it is in the call of the function. I found that the syntax have this form: extern void __namemodule__NMOD_namesubrutine(arg)

View 6 Replies View Related

Programming :: C++ - Calling Functions From Other Files And Headers?

Apr 11, 2011

I feel like there should be a cleaner way of doing this. I have one file, for example "a.cpp", calling a function from another file, "b.cpp". Currently I have it set up so that header for "b", "b.h", has the declaration of its functions. And then I'm just including "b.h" in "a.cpp". Do I have to include the "b" header file in "a" to be able to call a function from "b"? Or is there a better way I could be doing this? Like doing something different at compile?

View 7 Replies View Related

Programming :: Calling Gcc From Executable File / (makefile)

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

Programming :: Calling Kernel Functions From Userspace?

Feb 5, 2010

I'm trying to call some kernel functions from userspace, but I'm not sure if I'm doing it right. The functions control a pulse width modulator on an embedded platform. To pick one at random, the function:

Code:
struct pwm_device *pwm_request(int pwm_id, const char *label);
is defined in linux/pwm.h, and the implementation uses the macro EXPORT_SYMBOL(pwm_request), so I should be able to call this from user-space... right?

Anyway, I've got linux/pwm.h to #include in my source so the compiler knows what it's doing, but what do I link against? The only place in by kernel build tree where I can see a symbol pwm_request defined is in object files like vmlinux.o, built-in.o in the directory, etc. which I don't think I should be linking against.

View 2 Replies View Related

Programming :: Calling Multiple Files In FORTRAN90

Oct 29, 2010

I have written FORTRAN code to calculate density profile. This code will open two files ( topology and x,y,z trajectory). The trajectory file contains XYZ data coordinates for multiple frames (about 20 or 100 frames for instance). One frame contains 20736 data.

Previously this code was written to open ONLY one input XYZ data file and do the calculation and would dump the results in separate file and it was running without problem. Recently my data file get bigger in size, so I decided to break the single XYZ data file into few small parts.

Now I have modified the code so that it calls the parts of the XYZ data files ( eg: maltoTHERMO_10Frames.traj, maltoTHERMO_20Frames.traj,... and so on) and do the calculation and dump the results in the same result output file. I have tested this code just with openning the XYZ coordinates and printing into another file to see wheather it collecting the data sequently and it was working fine.

This code supposedly read the x coordinate data and calculate distance and put a count accoding the criteria in the approperiate bins. But when I let the code to do the calculation it stop and shows error. (I have indicated as !** in the code). If I enable this line, it shows error but if I disable this line, than the code do collect only the XYZ coordinates.

The code is as below:

Code:

module all_parameter
integer,parameter :: MAXATOM=20736!CHANGE
integer,parameter :: midwater=1500
integer,parameter :: TOTALFRAMES=20

[Code]....

View 8 Replies View Related

Programming :: Calling Script From Php Page Is Not Working?

Mar 2, 2011

I have typed the following code:

Code:
<html>
<form enctype="multipart/form-data" action="upload.php" method="POST">

[code]...

View 3 Replies View Related

Programming :: Calling Sizeof From Custom Function?

Oct 17, 2010

lets look at code in C

Code:
#include <stdio.h>
#include <stdlib.h>

[code]...

View 3 Replies View Related

Programming :: Play With Calling Text Files In C

May 5, 2010

I am trying to play with calling text files in C. What I have is a text file with 4 columns of numbers I need to average 2 of them. I have started and hit a wall. I have the following so far:

[Code]....

I still need to figure out how to read the data in. I have been reading on this for a few hours and its not clicking. How does the program know which columns with names to call. the data is organized: ID, Day, Speed, Temp.

View 6 Replies View Related

Programming :: Calling Constructor Of Dialogbox In Main Using Netbeans

Mar 28, 2010

In my project,Login window is created as a Dialog box.So when i tried to call the constructor of Login from Main it was generating an error regarding the arguments passed.I have not used any arguments when i called. when i looked at the code, the function was declared as public Login(java.awt.Frame parent,boolean modal)so when i call it from main(),what am i supposed to do ?

View 3 Replies View Related

Programming :: Calling System Calls In C Runtime (in The Run-time)?

Sep 23, 2010

I know there is a way to call winapi in runtime in windows. I want to ask how can I call a system call in gcc in runtime (when I don't know what it can be)? I don't mean syscall that I think is for calling only system calls and not library functions.

View 4 Replies View Related

Programming :: Calling Vars In A For Loop In A Shell Script?

Oct 8, 2010

# variable declaration
stt=10
enn=20
stp=1

# I want to do it in the following structure but not sure how to call # the stt, enn and stp in a for loop

for (( i = $stt; i -le $enn; i=i + $stp ))
do
blah blah
done

View 9 Replies View Related

Programming :: Push All Special Varible Before Calling A Fucnction?

Nov 4, 2010

I have a code like this:

Code:
open (INPUT,"<file"){
while (<INPUT>){.

[code]....

View 1 Replies View Related

Programming :: Scalar Arguments - Changes Reflected In Calling Program

Dec 3, 2010

(For function arguments): Scalar arguments are passed by value, which means that a copy of the argument is made for processing in the function, and changes to the argument in the function won't be reflected back to the calling program. Objects though, are passed by reference: any changes to them in the function are reflected in the calling program. What sense does this make? Why have they done this?

View 3 Replies View Related

Software :: Calling A Bash Shell Script From Within Another Script?

Apr 9, 2010

I am trying to call a script say mkdir.sh into another script that will make use of the dir's which are created in the first script. I know that I could code it all together, but I am trying to avoid rewriting the mkdir script as it is long.

View 7 Replies View Related

Programming :: Calling Umount2() Unmounts Volume But Df Entry Still Visible?

Nov 14, 2010

This is an odd one. I have a C program that calls umount to unmount a volume. A simplified case looks like this:

Code: int main()
{
int rc = umount2("/v0", MNT_FORCE);
if (rc != 0)
{
printf("Unable to unmount volume /v0, err='%s'", strerror(errno));
code....

I also discovered the reverse effect with calling mount() in code. When I make a call like Code: mount(drive, volume, "xfs", MS_NOATIME, NULL); the indicated drive is mounted since I can access the files as expected, but df doesn't show the drive has been mounted.

Why is my C code behaving this way? What do the mount/umount commands do when run from the command line that I'm not doing in my C code?

View 6 Replies View Related

Programming :: C++ Program Calling A Fortran Subroutine With A Function In The Argument?

Mar 9, 2011

I have a new problem; i want to call a subroutine's fortran which have a function in the argument and the compilation ran properly, but when i execute the program this shows me an "Segmentation fault". This is my c++ program:

Code: //Main.cpp
#include <stdio.h>
#include <iostream>

[code]....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved