General :: Arguments When Calling A Script ?

May 13, 2011

Suddenly, i have problems when i call a script when i use some arguments/variables

Here is my code:

Code:

This is my output:

Code:

View 3 Replies


ADVERTISEMENT

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

General :: How To Log All Processes Launched And Arguments

Dec 16, 2010

I would like to get a log of all processes that are launched with the time that they were launched and the arguments they were launched with. Is this possible in Linux?

View 3 Replies View Related

General :: Generating Two Bash Arguments From 'ls'?

Jul 3, 2011

I have a directory containing the following files.

Code:

1-res-opt-I189N-0001.pdb
1-res-opt-I189N-0002.pdb
1-res-opt-I189N-0003.pdb
1-res-opt-I189N-0004.pdb

[code].....

What I want is something like:

Code:

for i in *.pdb
do
python my_script.py 1-res-opt-I189N-00{1..10}.pdb 3-res-opt-I189N-00{1..10}.pdb
done

such that always the two files with corresponding index are submitted together to the Python script. How do I do that?

View 4 Replies View Related

General :: Pass All Arguments To A Function?

Jul 6, 2010

I've got a sticky little problem with a bash script. Please consider the following code:

Code:
#! /bin/bash
processArgs() {
echo "Count = $#"
while [[ $# -ne 0 ]]; do
echo $1
shift
done
}

processArgs $* If I call this script with Code: ./script first second third it'll print each of the argument on a new line - exactly what I would expect. However if I call it with

Code: ./script "Single Argument" "Second-Argument" it splits the first argument in two using the space as a delimitor. The problem appears to be the call to processArgs, where $* doesn't honour the quotes around the variables sent to the script.

View 4 Replies View Related

General :: Passing Program Arguments To Gdb?

Nov 18, 2009

I'm using gdb to debug my program. My program requires arguments (e.g., ./prog -dfile).But if I use gdb as in gdb ./prog -dfile, gdb wants to interpret the -d argument. How do I pass an argument to my program via gdb?

View 2 Replies View Related

General :: Calling URL From Shells Script

Jun 13, 2011

I have to call URL from shell script. E.g.: www.google.com. How can I call URL from the shell script.

View 6 Replies View Related

General :: Default Arguments To Save Time?

Mar 29, 2011

How do I set ls so that when I type ls it actually runs ls -l. This Sounds minor but I'm trying to save keystrokes wherever I can. This is on Ubuntu 10.10.

View 4 Replies View Related

General :: BASH Scripts Check For Arguments

Mar 5, 2010

I know that $1 ... $n will set the argument to the values but what happened if I have many options in one scripts lets suppose.

I can run:
myscript -1stargument -2ndargument -3rdargument
or myscript -1stargument
or myscript -1stargument -3rdargument

In my scripts I have
if [ $1 = "-1stargument" -o $2 = "-2ndargument"] #for every instruction I need
fi

but is there any way to do:
if [ (any arguments or commands) = "(mydesired option ] ; then
(do this...)
fi

View 6 Replies View Related

General :: Calling Application From Char Driver?

Oct 13, 2010

I want to call a application file in user space through a character driver running in kernel space.

View 1 Replies View Related

General :: Clean Makefiles After Calling ./configure

Aug 17, 2010

how can you remove all the makefiles and whatnot and basically restore the source package to its original form after you've called "./configure" or even "make" ?

for instance you changed the source code then you ran ./configure then make then make install ....etc you checked the software and it functioned as you expected it does , now you want to remove all the makefiles and all that other jizz that you don't need or want anymore in the source (obviously in order to package it for distribution)

what is the "standard" method for doing so?

View 5 Replies View Related

General :: Calling A Script And Giving It A Variable?

Apr 22, 2011

I have a script1.sh (see code below) which calls another script (which is a sort of template -> template.sh). But when i call template.sh i need to send an argument with it.

Code:

#!/bin/sh
VAR=`./template.sh -d $dirpath`
exitstatus=`echo $VAR`

[code]....

echo "$VAR files which are older than 1 hour in folder $dirpath" exit $exitstatus I geuss the command should look like something like this command

Code:

./script1.sh -d /

You don't have to look at the code of template.sh, thats not important. I just need to know how i get this to work I don't think it's that hard, but i just can't see it ...

View 2 Replies View Related

General :: How To Exit Out Of The Calling Shell Script

Aug 18, 2009

I have 2 shell scripts, script1.sh and script2.sh. I call script2.sh from within script1.sh ( by simple ./script2.sh command). Based on some condition, i use exit 0 to exit out of script2.sh. I was trying to find if i can exit out of script1.sh as well at once. below is the example

script1.sh
#!/bin/bash
echo "Before ..."

[code]....

When i execute below is the output

Before ...
There was problem file is empty
The Script will Exit. Please fix the issue and run again...
After ...

I am trying to exit out of script1.sh as well so that i dont print "After ..."

View 3 Replies View Related

General :: Determine The Value Of The 'irq' Argument Before Calling Function?

Oct 27, 2010

I read somewhere that you should not be reading config space to determine the irq value to pass as the first argument to request_irq(). What is the proper way to determine the value of the 'irq' argument before calling this function? Hope this is the correct forum. I don't see one for drivers.

View 1 Replies View Related

General :: Limit Unix Top Command Columns Via Arguments

Jun 2, 2010

I'm pretty sure this is super simple, but I've searched and searched and for the life of me I can't find any info on how to limit the columns that display in the interactive top program with arguments passed from the command line. I recall seeing something formatted like this ...

~/top -f (kdx)

Which would only show the %CPU, UID, program name fields/columns. I'd like to display the results in a really narrow terminal window on the right side of my desktop.

View 5 Replies View Related

General :: Passing An Array As Command Line Arguments?

Apr 2, 2011

how to pass an array as a command line argument in a shell script?

View 5 Replies View Related

General :: Passing Multiple Arguments In Shell Script?

Dec 11, 2010

The script receives multiple files as parameters and it is supposed to count the number of lines in each of them and write that number in another file.

This is my script:

Code:

while [ -n "$1" ]
do
lines=`cat $1 | wc -l`
echo "The number of lines in file $1 is $lines." >> lines.txt
shift
done

Is there any other way to do the same thing, without using shift?

View 7 Replies View Related

General :: Calling A Shell Script To Make Few Builds

Jul 27, 2011

I am setting up a cron job, where i am calling a shell script to make few builds. I got struck at a point, need some expert inputs to proceed further. The script is categorized in 5 parts and in the last part while building software it asks for few questions like:-

1. Build mode choice
2. normal build
3. Copy Images
4. Arch

User manually has to input ans for these questions:-
1
yes
n
64

The ans's are fixed and this won't change. How shall i hard-code them or do something in the script so as when script flow reaches to this point it automatically take's these value. So far the cron job is not getting completed as it's waiting for user to key in these values manually. I had faced similar issue while building kernel modules but there it was easier as i had to take default values always:-

View 2 Replies View Related

General :: Error While Calling Capget Function (EINVAL)?

Apr 27, 2011

Error while calling capget function (EINVAL)

View 1 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 :: Passing Commands As Arguments To Functions In Bash Script?

May 31, 2010

I wrote a simple bash script to let me treat any set of programs like a deamon. For example if I configure the script a certain way I can start/stop/get the status of apache, mysql and php all from one command. I am having a bit of a problem though. I am passing commands as strings to a function and then depending on the arguments to the script it might run one of these commands or another. Some of these commands need to beun in the background though, such as deluge-web. When I send "deluge-web &" to the function and it execute it deluge-web does not start in the background. I can't figure out why this is. I have tried escaping the & with ''s and with a , but nothing seems to work. I know that this is some idiotic thing that I am overlooking, but I am a bit stumped. Here is the script configured to start/stop/get status of deluged and deluge-web.

Code:
#!/bin/bash
function checkanddosomething {

[code]...

View 3 Replies View Related

General :: For Loop - Make Use Of Arguments Passed To Scripts Ranging From 2nd To Last

Feb 20, 2011

I am writing a scripts which involves for loop. I want to make use of arguments passed to scripts ranging from 2nd to last. I tried to use below

Quote:
kint `whoami`/root
for i in $2..$*
do
ssh root@$i "cd /local/0/home;mkdir -p $1/test"
done

I am trying to run it as below

Quote:
./scriptname webtech myserver1 myserver2 myserver3

and it gives following error Quote: ssh: myserver1..myserver2: name or service not known I basically want to pass arguments from myserver1 to myserver3 to the script.

View 7 Replies View Related

General :: Reusing Find Command Results In Mplayer Arguments?

Jan 22, 2010

I wanted to supply mplayer with the output of find command as arguments. The error returned showed spliced names of files whenever spaces occurred. I have subdirectories in my /home/my_user_name/Music/ directory, and in them multiple *.oga music files. The actual command that I issued was

Code:
mplayer $(find /home/my_user_name/Music/ -name "*.oga")

mplayer started but then was looking for broken file names. I am thinking quoting has to do with it to preserve the filename as one string but different attempts were met with inroads:

Code:
mplayer `find /home/my_user_name/Music/ -name "*.oga"`
gave me the same result and
Code:
mplayer `"find /home/my_user_name/Music/ -name *.oga"`

complained about wrong mplayer syntax.

View 1 Replies View Related

General :: Calling All FreeNX - Cannot Connect The Macbook's NX Client To The Server

May 2, 2010

I am trying (desperately) to setup freeNX so that I can access my Mandriva box from my Macbook over my network. I have great need to be able to do this. Here's the necessary info for you: Mandriva PC: running Mandriva 2010.0 with freeNX installed from the Mandriva repos Macbook: running OS 10.4 with the Nomachine NX Client installed Now, I have followed the setup from the Mandriva wiki as well as the freenx wiki to no avail. I simply cannot connect the Macbook's NX client to the server. I get an authentication failed message. However, I can ssh from the Macbook to the server just fine (that's how I'm getting most of this work done).

[Code]...

View 3 Replies View Related

General :: Bash : Pass Command Line Arguments Containing Special Characters?

Jul 14, 2010

I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program(there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]".Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.?

(Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)

View 7 Replies View Related

General :: Bash: How To Pass Command Line Arguments Containing Special Characters

Jun 24, 2011

I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program (there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]". Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.? (Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)

View 8 Replies View Related

General :: Arch Usability - Pass Arguments From A Shell Script To A Program?

May 7, 2010

1. What file do i have to edit in order to include /usr/local/bin in the class path (ie. I put an executable in /usr/local/bin and when I try to execute it, it says the command cannot be found, etc.) EDIT: Solved, just didn't set PATH correctly. EDIT: New problem. When I try to execute a program in /usr/local/bin, it says "fopen: john.ini: File not found" Yet when i cd to /usr/local/bin, it doesn't say that. What would cause this?

2. Once I get my system setup the way i like it, how would i go about making it into a bootable CD/DVD?

3. How would I pass arguments from a shell script to a program?

View 4 Replies View Related

General :: Calling Gurus And Noobs - Review Filesystem Hierarchy Explanation?

Jun 10, 2010

Back when I was first learning Linux, one of the questions that I kept wondering about was "what are all these files and directories for?" I couldn't find a resource that would explain them in a digestible manner. Specifically, I was looking for one that would allow me to look at a Linux filesystem interactively, collapsing and expanding folders to look at just the ones I was interested in at the moment. So later, when I got the opportunity, I wrote it.

But despite a ton of research, I'm still not totally knowledgeable on the subject. The most important thing I'm looking for right now is for experienced Linux/Unix people to tell me where I got stuff wrong, and for newbies to tell me how useful it is to them and which things need clarification. I'm also interested in technical and graphical ways to improve usability, like better icons, layout, etc. I know I need to be able to collapse long descriptions, but what would you like to see? The Works Cited list and a full introduction are still on the way as of this writing.

Without further ado: Linux Filesystem Hierarchy Explanation. You'll need a fairly recent browser that can handle XSLT; the actual info is stored as XML, and transformed into HTML with an XSLT stylesheet. This is still a work in progress, and I'll be updating it as the thread progresses.

Finally, would people be interested in collaborating with me on this, as an open-source project? I've never done anything like that, and I'm not sure how much time I'll be able to give it in the future, but I really think this should be continued and expanded.

Edit: Works Cited and decent intro are now in place.

View 3 Replies View Related

General :: Running Shell Script Taking Command Line Arguments In A Jsp Page?

Feb 10, 2011

how to run a shell script taking command line arguments in a jsp page.

View 1 Replies View Related

General :: Write Shell Script That Takes A File Path As Command-line Arguments?

Dec 14, 2010

How can i write a shell script that takes a file path as command-line arguments.and it should report whether the path denotes a file or a directory.

View 2 Replies View Related







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