Programming :: Script Inside Another Fails To Run / Why Is So?
Feb 2, 2010I am developing a script for the first time.
I am calling a script B.sh from A.sh
What if B.sh fails to run...how to go about it...
I am developing a script for the first time.
I am calling a script B.sh from A.sh
What if B.sh fails to run...how to go about it...
I am very new to shell script, and my requirement is --
1. open the apache access log, use "cut" and "grep" to find the numbers.
2.put the result in a file
3.then compare the same result with day before result
4. send the result via e-mail.
so how can i do that , using some functions..
Is is possible to use a class inside a struct? I keep getting segmentation fault with this code:
Code:
struct my_struct {
unsigned count;
std::string msg;
[code]....
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 RelatedI want to read content of a file inside a gawk script.I know that by using "gawk -f filename" I can read a file, but I want to do that inside the script.
View 7 Replies View RelatedBasically I have a dir that contains my makefile and another directory inside this called source this holds main source files. External to these I have a couple of dirs common and drives.
In my make file I use
To include the protoypes from the headers in the folders common and drivers used by source, this works fine. However in common and drivers I use a few variables that are set in the source dir. I set these with externs inside the common and driver files. However I'm sure I should be able to set the directory path for source inside my makefile. So say I have inside source hardware.h with prototypes, I set DINCDIR = -I/Source -I../Drivers -I../CommonFiles
Then from a c file inside my common folder I say #include "hardware.h" the file should be able to see hardware.h and it's protoypes. However I get:
Is there some way I can get the extern dirs to see the source dir?
The set out is something like;
im pretty sure this is a remedial task for many of you but im having an issue with arrays from a shell script being accessed in an awk command. im pretty good with shell scripting but i am embarrassingly unfamiliar with awk. so here's the meat of the script...
Code:
I am trying to take an input file of ip addresses and corresponding netmasks and put it into a format to be loaded onto a juniper switch. the result should look something like this.. x.x.x.x/netmask using the cidr notation. no matter what subnet is provided though, /32 always gets appended to the end of the ip even when it should be /16, /24, etc... also, the cisco part works fine so that doesnt need any attention.
I want to do the following redirectin inside a bash script :
1. all the stdout will be redirected to a /tmp/log
2. all the errors will go to the stderr and also to the /tmp/log.
The following inside a bash script is not working, WHY and HOW to do it:
Rest of the bash script.
I have a script that creates a textfile with ip addresses and ports, but the ports are in hex format so they need to be converted.
Currently I have this code:
Code:
I'd like to have the second column in decimal instead of hex, like this:
Code:
Is there any way to do that with awk, preferably in a oneliner? Would printf be an option?
Is it not possible to declare a vector inside a C++ class ? Have a look at the following code:
Code:
#include <stdio.h>
#include <iostream>
#include <malloc.h> // malloc
#include <strings.h> // bzero
[code]....
I want to use a function that able to get the current clock time when I call it from inside my wireless driver?
View 1 Replies View RelatedI have that script that checks the nfs mount points:
Code:
#!/bin/ksh
#set -xv
test="DO_NOT_DELETE"
rc=0
[Code]....
I am no expert in loops and it took me all day to write that. I couldn't really tell how to match the string in $df_file and $fs_share, so I did a little workaround with a count.
I have a fallowing ASCII text file:
Code:
Fa0/2 - server1 / testing
Fa0/4 - server2 / production
[code]....
For a search box on my site, I want a textbox, which will let the user input the term to be searched for, and next to it I want a drop down list that'll have, for example, "Fruit" and "Vegetables" as categories to be searched within. How do I do the HTML for this? (so that the arguments to my search.php script will be eg. "search.php?text=apples&type=fruit" ? )
View 3 Replies View RelatedWhat I'm trying to do is grep [mysqld] from inside my.cnf and then add lines inside the file should they not be there. how do i do that?
View 3 Replies View RelatedThe following two pieces of codes share printing to stdout with a POSIX semaphore /dev/shm/sem.abcd
sema1.c:
Code:
int j;
sem_t *sem = sem_open( "/abcd", O_CREAT, S_IRUSR|S_IWUSR, 1 );
j = 0;
while (j < 100) {
[Code].....
If started at the same time, the first will finish in about 10 seconds; the second 20 secs.
What I want to ask is, if the first program crashes at Checkpoint A, then B will never gets to continue, then normally how do programmers avoid this kind of deadlock due to crashes inside the critical section?
What I want to do is from a file having block like
<event>
8 3 0.2685416E-02
2 -1 0
21 -1 0
[code]...
The first line after the "<event>" is its process-id, so I would like to have at the end a summary of how many "event" block I have for each type, ie how many
6 1 0.2685416E-02
or how many
7 2 0.2685416E-02
etc etc
I do not know in advance how many different-kind of block I will have, so it has to be a bit smart to scan the file, and make an new "summary" info for each unique type I was using something like
awk '/<event>/,/</event>/{if ($3 -eq 0.2685416E-02 ) { print $1" "$2" "$3}}' file > out
and then
grep -c "$1" "$2" "$3" but with no success since my awk commands prints all lines of each block
Suppose, that in advance I do know the $3, ie the 0.2685416E-02 which is a kind of weight
how to search for a specific string of text inside an html document. I then want to cut out that specific data that the field or string contains. I want to do a shellscript that makes this function automaticly.
For example:
#
#Here i want to find the field "town" inside the html/java and then cut #out the town name from it and paste that to an file.
#
#
[Code].....
I started using Ubuntu's chat tool the other day, I gave it my Gmail username and password,and lo! it found my list of CONTACTS FROM INSIDE GMAIL!Facebook has done the same thing as well! Was this in Google's terms? Can't something be done about this? This is SCARY.But also, a small part of me wants to know how it was done (only a small part, this protocol sh*t is not particularly challenging, right?
View 14 Replies View RelatedI need to convert an int array into a char* array.
I'm using the following code:
Code:
But it returns me
Code:
Trying to write a small php program to send emails using a form. I have collected all the information in php variables and I can send the mails just fine. But I need some neat and clean formatting for the mail that is received and hence thought html tables would be nice. But all the html tags are received as plain text and not html though I have mentioned in headers content-type to be html. Any links? If anyone can put some light on it? I thought that html tags would just work fine without much issue. I have tried same with asp and it worked.
PS: I am no programmer. Just trying my hands out on some php.
Edit: I am using a php mailer class from php classes to send mails. I need some way to use an external smtp server for sending mails. I have seen pear but I do not want to use pear. It is not available on the server I am testing and it is not possible for me to install it. I do not have access to install pear and can not ask to install it.
I have encountered a problem:I have "while" loop; at each run a set of outputs is produced but then I need to shift them into a corresponding folder ; otherwise next run the new outputs will be over-written. Furthermore, I need to pipe what I have on the screen inside a file. I have put my code in the following:
Code:
# !/bin/bash
jf="GeoQuery.jar"
[code]...
Writing script to create backup of file by adding datetime to file name. Basically test for file presence if there, cp with datetime then rm original cp works fine from command line but get cannot stat `full path to file': No such file or directory
Code:
Here are the errors: cp: cannot stat `~/html/CVP_dadamail/.dada_files/.logs/errors.txt': No such file or directory rm: cannot remove `...': No such file or directory
The for statement is a placeholder as I have same file to backup out of several directories. using "bash -x scriptname" -OR- inserting echos, I can see I've constructed the strings properly. Believing it might be related to the hidden directories, I tried setting the shopt "glob" options to no avail.
Ultimately I'll add the other directories to the for loop and then run this from a cron job, so if you see potential pitfalls knowing I'm headed in that direction...believe construct would be
Code:
I'm trying to create an SSL certificate and answer the questions inside a bash script. The command used to create the SSL certificate
Code: openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem
The first question asked is. Country Name (2 letter code) [AU]:
Does declaring variable inside a function give an extra overhead on an application? Would it be better to declare the variable globally and just reuse it? Example
Code:
#include <blah>
char mybuffer[2048];
int main()
[code]....
The only difference is the declaration of my variable. Since myfunction() will be called many times will it add an additional overhead if it will create mybuffer[2048] over and over?
I have a PHP script which will show info from 5 lines in a MySQL database, with a "next" button to show the next 5 lines and so on. Initially it'll get called with a ?page=1 in the args in the URL, and then onward I want the "next" button to link to the same script , but with a ?page=2 in the args. First of all, how can I access the "page" variable inside the script to see what args it's been given? (sorry, extremely newbie question here )
And secondly, what will the code for the "next" button look like? If the script is called "seenames.php", I want this: print "A HREF="...cgi/seenames.php?page=$page+1">Next</A> , if you get my meaning. But what will the quoting for the above line be? I'm sure I've got it wrong.
I have a really simple program trying to use XInput2.h, which fails on linking
Code:
#include <X11/extensions/XInput2.h>
int main(){
Display *XSession = XOpenDisplay(NULL);
int OriginScreen = 0;
int pID = 7;
[Code]....
I'm at a loss about what to do. Replacing XIWarpPointer by XWarpPointer and removing the pID argument solves it, but is not an option (no input ID).
I am running into a problem with a script I have to load the proper ethernet drivers on the script start, but the modprobe command fails.
I don't know exactly what it says but I believe it was something to the effect of "cannot find (x)." Which would be fine if it did it all of the time, but if I ctrl+c out of the script and attempt to do the command manually it works.
Anyone out there know what might be going on? I've been searching google and stackoverload and here and haven't come across anyone else having this issue.
Or better yet, is there a way to have a shell script implement a .rules file for a specific instance?
Recently, every time I try to compile an app from its source code, after issuing the ./configure command I get this message:configure: error: C preprocessor "/lib/cpp" fails sanity checkSee `config.log' for more details.I check /lib/cpp but there is not directory named /cpp under /libthis problem occurs on all source packages.
View 3 Replies View RelatedI am trying to compile systemc. Configuration is done OK and Makefiles are created. As soon as the "make" command i issue, recursively reaches the "utils" directory, errors are produced -declaration and include errors.
The files referenced by the errors DO exist and i hava managed to give g++ "-I ${LD_INCLUDE_PATH}, ie the variable, where all header dirs are listed. Libraries and compilers for gcc3.3 and g++3.3, i believe, are installed OK. code...