Programming :: How To Use A Function Inside A Shell

Apr 28, 2011

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..

View 1 Replies


ADVERTISEMENT

Programming :: Does Declaring Variable Inside A Function Give An Extra Overhead On An Application

May 14, 2011

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?

View 5 Replies View Related

Programming :: Write A Function In A Shell Script?

Sep 22, 2010

I need a help regarding writing a function in a shell, what exactly a function does!!

View 3 Replies View Related

Programming :: Scenario For Call Shell Function From Mysql?

Apr 18, 2011

I am trying a scenario for calling a shell script when ever a trigger is called. Can some one guide me how to achieve this scenario. Also it should passes the value from the table to the shell script. Can some one explain me along with the example.

View 2 Replies View Related

Programming :: CGI Shell Scripting : Possible To Call Function From Other Script?

Mar 15, 2011

I got two cgi shell scripting files. Is it possible when i am in file 1, to call a function from file 2?

View 2 Replies View Related

General :: Write A Shell Script Instead Of Shell Function?

Apr 27, 2011

I would like know when it is necessary or advisable to write a shell script instead of shell function ?

View 3 Replies View Related

General :: Using An Alias Inside A Function In Bash?

Jun 8, 2011

I have trouble with using an alias inside aash function. I would like to ssh into multiple machines by executing:ssh machine To achieve this, I put something like the following into my ~/.bashrc:

alias machine='user@machine'
ssh()
{

[code]....

View 1 Replies View Related

Ubuntu :: How To Get Wireless Manager To Function Inside FVWM

Jun 29, 2010

I have a fresh desktop install ubuntu 10.04 which then I added the fvwm-crystal package (and dependencies). I logout of gnome, and into fvwm. When I do so, I lose my wireless connection that was started when I was in gnome. Is there a way to get a wireless manager to function inside fvwm (if I add it to the auto-start in my fvwm2rc?). What app can I use? I tried and failed miserably using the command line iwconifg/iwlist tools.

View 2 Replies View Related

General :: Shifting Positional Parameter Inside A Function?

Oct 19, 2010

I need to shift the positional parameters of a script inside a function, but any call to "shift 1" inside a function shifts only the parameters of that function. Is there some way of accomplishing that? I tried another approach using an alias. The problem is that I have to take the result of the alias. So I call in my script:

Code:

var=$(shiftalias)

At first time, it works correctly, but after that it does not shift the parameters anymore.

View 9 Replies View Related

General :: Scripting - Try To Passing Arguments To For Cycle - Inside A Function

Apr 26, 2011

The code:

Quote:

Problem: I need a method to maintain the $i variable. In fact, actually, this variable get lost when executed. I think that an escape can preserve this variable and permit its execution inside the function, but I've no idea about.

View 3 Replies View Related

General :: Function Having Background Process Inside Command Substitution

Oct 5, 2010

The first call to "somefunction" works as expected. The function prints "endfunction" and a process in background sleeps 30 seconds. In the second call I thought it should work in the same way, but the script sleeps 30 seconds before it prints "endfunction".Does someone know the reason of this behavior? Is there another way to do a command substitution of a function that has a background process without have to waiting for that process?

View 2 Replies View Related

Programming :: How Can A Friend Function Access A Public Function From A Base Class

Nov 16, 2010

Code:
#include <iostream>
using namespace std;

[code]...

View 1 Replies View Related

Programming :: Passing Data From Interrupt Handler Function To Tasklet Function?

May 18, 2010

I am doing some Linux kernel programming for my research project. I need to record the timestamp (by using cpuid and rdtsc) when an interrupt handler (top half) is first invoked. Due to the time critical nature of the problem itself, I have to do the timestamping inside the interrupt handler itself (the first operation when the handler is called). However, I understand that tasks that are not so time critical should be deferred to a tasklet function (bottom half) for processing because other interrupts are disabled in a (top-half) interrupt handler. I am currently out of idea on how I can pass the timestamp information that I have obtained in the interrupt handler to the corresponding tasklet function.

View 2 Replies View Related

General :: Using Bash Shell Script Inside Php?

Dec 30, 2010

how do i use bash shell scripts inside php.I am just trying to call a simple cp command using php. Its not doing anything.

View 2 Replies View Related

General :: Executing Shell Script With 654 Permissions Inside Another One

Apr 22, 2010

I have this scenario, where in I'm calling a shell script inside another shell script. The only criteria here is that the embedded script will have 654 permissions and the master script should be able to execute this embedded script. The sample code is given below:

#!/usr/bin/ksh
maindir=/usr/home01/temp/dir
bindir=${maindir}/batch/bin
${bindir}/test.ksh -d ${dblogin} -i ${datadir} -r ${filedt} > ${tmp_log}

The test.ksh which has 654 permissions is called by the main.ksh script and when I try to run it using ./main.ksh, it fails with the error "Execute permissions denied."

View 2 Replies View Related

Ubuntu Installation :: Gnome-shell On 10.04 Beta Inside Virtualbox

Apr 12, 2010

I have installed VirtualBox because I want to test out things like 10.04 and gnome-shell. So, I have downloaded an Ubuntu 10.04 32-bit .vdi from mininova (and so far I'm assuming that the downloaded file is good), and I've been tooling around with it a bit. It was a bit choppy at times, but that was probably because I was running several other things at the same time. My comp's stats are in my sig (only addressing 2.9 gigs of ram due to the 32-bit kernel), and I think that any choppiness was due to overloading the computer with other things. The proc temp also went to record highs, ~75 Celsius, iirc. The vm has been alloted 1 proc (out of 2) 512 ram. The problem I am having is that I wanted to install gnome-shell to try it out, but I get an error,

[Code]...

View 6 Replies View Related

Ubuntu Installation :: Getting Gnome-shell On 10.04 Beta Inside Virtualbox?

Apr 25, 2010

I have installed VirtualBox because I want to test out things like 10.04 and gnome-shell. I have downloaded an Ubuntu 10.04 32-bit .vdi from mininova (and so far I'm assuming that the downloaded file is good), and I've been tooling around with it a bit. It was a bit choppy at times, but that was probably because I was running several other things at the same time. My comp's stats are in my sig (only addressing 2.9 gigs of ram due to the 32-bit kernel), and I think that any choppiness was due to overloading the computer with other things. The proc temp also went to record highs, ~75 Celsius, iirc. The vm has been alloted 1 proc (out of 2) 512 ram.The problem I am having is that I wanted to install gnome-shell to try it out, but I get an error,

Code:

adminuser@adminuser-desktop:~$ sudo apt-get install gnome-shell
[sudo] password for adminuser:
Reading package lists... Done
Building dependency tree

[code]...

So, I have xulrunner-1.9.2 already, so I tried to install 1.9.1 anyway, and it appeared to install, and I now have 1.9.1.9 and 1.9.2.3 installed, but trying to install libgsj0 results in the same error as above.

View 9 Replies View Related

Ubuntu :: 'set' Command In Terminal Has Shell Scripts Embedded Inside?

May 3, 2010

I just installed Ubuntu 10.04 for some development. I was trying to set some environment variables are noticed that when I hit 'set' inside a terminal (to dump environment vars) I get the usual first few variables but then I see a whole lot of script code ....

Code:

WINDOWID=23068675
XAUTHORITY=/var/run/gdm/auth-for-sid-5IDovs/database
XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/

[code]....

I've installed a lot of tools (NetBeans, Ruby, Java, build-essentials etc) but essentially I installed Ubuntu today - so it shouldn't have rotted out this quickly. is this hijacking of environment vars to embed script code intentional with Ubuntu 10.04?

View 1 Replies View Related

General :: Play Beep Sound Inside Shell Script?

Aug 4, 2011

I need to make beep sound inside my basic shell script. code...

View 5 Replies View Related

General :: Redirect Output Of A Command To Another File Inside Shell Script?

Aug 26, 2010

I am writing a script in which I am using AWK to append to a line in a file and save the file. The command I am using is:

Code:
awk '{s=$0; if ( NR==4 ){s=s ":/usr/java/jdk1.6.0_19/bin" } print s;}' $appName > $appName.new

[code]...

View 4 Replies View Related

Programming :: Declaring A Function In A Function - C Programming

May 24, 2010

I want to declare a function in a function, but had no success till now, see the error code below and visit the project at sourceforge

[Code]...

View 14 Replies View Related

Programming :: Bash Array Add Function Example Using Indirect Array Reference As Function Argument?

Jun 20, 2010

I looked on the net for such function or example and didin't find anything, thus after having made one i guess it would be legitimate to drop it to see what others thinks of it.

#!/bin/bash
addelementtoarray()
{
local arrayname=$1

[code]....

View 10 Replies View Related

General :: Invoke A Function In Bash Shell Script?

Apr 24, 2010

I just wonder the distinction calling the function between $(one_function) and one_function in bash shell script.

When I set the variable PS1 in ~/.bashrc, I can't invoke the function by one_func
ex:

export PS1="
[e[31m] $(one_func) # it works
export PS1="
[e[31m] one_func # it doesn't work

View 3 Replies View Related

Ubuntu :: Korn Shell: Syntax Error On Test A Function With Parameters?

Jan 4, 2011

Some may recall I recently gave up on bash, rather than give up my programming style.Surely I will have reason to return but that's another story. My little issue now:I am debugging a new [Korn] shell script. I have a function that performs a specialized match on a string and I see that I am able to call that function with no problem, with both of it parameters. The function does not do any print or echo command - it uses "return" for a TRUE (0) of FALSE (1), as is the shell exit code convention. Thus, I have the following test:

Code:
if [[ match_except_release ${PATH_DIR[$LC]} bin ]]
then

[code]....

View 2 Replies View Related

Programming :: Shell Scripting / Create A Shell Script Similar To Ls?

Jun 5, 2011

I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.

Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....

View 10 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

General :: Runs Multiple Shell Script Inside A Main Script Using Crontab?

Oct 22, 2009

I wrote a simple shell script called main.sh and inside it calling another shell script called rename.sh.Both are placed in a same directory.[/home/srimal/test]

$cat main.sh
Code:
#!/bin/sh

[code]...

View 4 Replies View Related

Programming :: Surface Fitting Using NR Function Svdfit ( ) In C Programming?

Sep 16, 2010

fit a surface i.e. W(x,y) using svdfit() provided by "Numerical Recipes in C". svdfit() is written for curve fitting and not for surface fitting.But one can use svdfit(), as claimed by authors of NR book, to do surface fitting. On page 680 of NR book, authors have given a hint on how to use svdfit() for fitting a surface. But I have not understood it.This link may be helpful (Chapter 15 th is relevant here.):[URL]This is my problem:

Code:
I have a set of 100 numbers. I want to fit a 2-Dimensional function W(x,y) to these numbers.

[code]....

View 2 Replies View Related

Programming :: Use A Class Inside A Struct?

Apr 8, 2011

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]....

View 3 Replies View Related

Programming :: Call C Executable Inside C

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







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