Ubuntu :: Pass Parameters To Bash Through Shellscript?

Mar 21, 2010

How do I pass file names as parameters to the shell through a script? I have installed 'wipe' from the repos and it is a shell based app. so I made a shellscript and put it in my script folder.

the normal usage of wipe is 'wipe -q /path/to/file' so if I were to make a shell script, right click on the file in question, and run the script on it, how to I permit the shell to wipe that file only, in other words pass it as a parameter. I think on windows it was the use of %1, such as. 'wipe -q %1' for example, which was simple enough. how to I achieve this with bash?

View 2 Replies


ADVERTISEMENT

Ubuntu :: Pass Parameters To Grub At Boot Time?

May 2, 2010

Old Toshiba laptop model A30 -- tried various installs 8.04/9.04/9.10. They all hung trying to boot the install disks after the initial few screens. Finally, I got 9.10 to install, dual booting XP and 9.10 by choosing F6 from the initial menu, and putting an X beside:

ACPI=off
noapic
nolapc
edd=on
nodmaid

and then hitting escape.But, after the install, I couldn't boot 9.10 from grub as it hangs after about 30 seconds of trying. The live CD would not work without the above parameters being set as described above, but does work with them set! I need those same parameters passed to grub at 9.10 boot time, but I can't figure out how to do that. I've had many successful installs of Ubuntu across a number of desktops and laptops, but I never had to deal with the guts of grub before. It all just worked.

View 9 Replies View Related

General :: Pass Shell Parameters To Awk Does Not Work?

Jun 16, 2011

Why does this work

Code:
for myfile in `find . -name "R*VER" -mtime +1`
do

[code]...

View 2 Replies View Related

General :: Pass Parameters To A Shell Script Running As Cronjob?

Dec 7, 2010

I am new to bash scripting (not programming in general).

I am writing a bash script that will run a Python script I have written.

I want to be able to do the following:

Pass parameters to the bash script via the cronjob (so I can have two cron jobs) one to be run with parameter 'foobar', and the other 'foo'
switch based on the parameter passed to the bash script (by switching, I mean an if/else based on the paramter passed to the bash script).

View 3 Replies View Related

General :: Shell Script File - Pass Multiple Parameters To Interpreter?

Feb 2, 2011

I have a Python script that I run which needs to execute under a special environment, so I would run the program like so from my working directory (~/project/src):

python manage.py shell

This opens up an interactive shell for me to start typing my own commands.I have another set of administrative activities that I would like to house in another directory (~/project/admin). The manage.py is really finicky about running from the working directory. So, to make this whole thing work, I made a script which starts off like so:

#!/usr/bin/python ../src/manage.py shell

There are a couple problems with this. The first is that it doesn't work:

/usr/bin/python: can't open file '"/../src/manage.py" shell': [Errno 2] No such file or directory

How do you specify multiple parameters to the interpreter?How do I change the working directory?

View 2 Replies View Related

CentOS 5 Networking :: Bridge Setting In Network-scripts - Pass Parameters Into The Ifcfg-vmbr0?

Jan 18, 2011

I set up a bridge device but I can not figure out how to pass parameters into the ifcfg-vmbr0 in particular I need to pass:

maxage
ageing

fd and stp seems to be passed by DELAY=0 and STP=on the others? I have not found anything in the post, tips, docs how could I do?

View 1 Replies View Related

Programming :: Pass Ip Address, Port Address And Some Parameters From Command Line?

Apr 1, 2011

I want to pass ip address,port address and some parameters from command line using python script.The ip address and port address for establishing socket connection and remaining parameters to execute different connection.

View 1 Replies View Related

Ubuntu :: Bash Parameters With-c Switch ?

Mar 11, 2011

From the man page for bash...

Quote:

If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0.

Code:

View 6 Replies View Related

General :: Get N-variable Parameters In Bash

Mar 21, 2011

I've a script that it's invoked with n-variable parameters. Here's an examples:

Code:
./myprogram.sh inputdir FIELD1 FIELD2 ... FIELDN outputfile In the script I would like to get the FIELD names that were passed.

View 4 Replies View Related

Programming :: Bash Script Sed -r -i And -e Parameters?

May 3, 2011

I have a bash script where I am replacing a date with a variable

Code:
variable="date"
sed -r "s/([0-9][0-9])/([0-9][0-9])/([0-9][0-9][0-9][0-9])/$variable/g" /path/to/file.txt
I have googled but cant find any info on what the -r, or sometimes I have seen -i and -e, after the "sed" I googled "sed parameters"

r appears to output the replaced date, but not change the original file. Usually using -i will change an original file for me. Does anyone know what the -i, -e, -r are about? A link to an explanation would be good, as I have been unable to find one in my searches.

View 10 Replies View Related

Programming :: Passing Parameters From C Code To Bash Script

Apr 16, 2011

I get no print to stdout on screen from the C code.Does bash somehow block or mask it?I get print from bash. I get this error in the non-test bash script like: let "rdval = $rdstr"syntax error: operand expected (error token is " ")The let command prints rdval= but I presume this is due to the printf test statements getting in the way.I am getting no compile errors. Why does the C code not print the values specified?

View 2 Replies View Related

Programming :: Parsing Unflagged Parameters In Bash Script?

Apr 6, 2010

I've searched online and found many examples using getopts, but nothing that clearly explains it use, nor any examples of what I'm trying to do. I have a script named "process". It can take from 0 to 3 different options. I'd like to be able to handle these options regardless of the order that they are entered.

Syntax:
process [-v] [-d #] [-h|-?] [string]
-v = verbose mode on
-d # = how deep to do the process, expecting a number parameter
-h or -? = show command usage
string = only process lines containing the specified string

[Code]..

View 5 Replies View Related

General :: Check If Any Of The Parameters To A Bash Script Match A String?

Sep 8, 2010

I'm trying to write a script where I want to check if any of the parameters passed to a bash script match a string. The way I have it setup right now is if [ "$3" != "-disCopperBld" -a "$4" != "-disCopperBld" -a "$5" != "-disCopperBld" -a "$6" != "-disCopperBld"]but there might be a large number of parameters, so I was wondering if there is a better way to do this?EDIT:I tried this chunk of code out, and called the script with the option, -disableVenusBld, but it still prints out "Starting build". Am I doing something wrong?

while [ $# -ne 0 ]
do
arg="$1"

[code]....

View 3 Replies View Related

General :: Pass A File That Changes Name To Another Command In Bash?

Jun 9, 2011

I frequently use wget to download tarballs and zip files from the web, then either untar then or gunzip them. I do:

Is there a way for me to automatically pass the zip file to tar or unzip WHILE wget-ting?

In pseudocode: wget google.com/somfile.zip && unzip

View 3 Replies View Related

General :: Possible To Pass JavaScript Variables To Bash?

Apr 18, 2011

Can I pass javascript variables to bash script? If possible in bash script what code should I insert to receive javascript variables.

View 14 Replies View Related

Server :: Get Variable From Bash From Mysql Or Pass From Php?

Apr 26, 2010

I am not parsing on a webserver so is it possible to have both

#! /usr/bin/php &
#!/bin/bash

in the same script? Alternatively, I have a current bash script that I need to get some variables from mysql and not sure how to get mysql results in bash:

Quote:

mysql -h server.net -u username1 -paaa -e "USE squid; SELECT email, usern FROM TABLE WHERE blah blah;"
emailadd="resultfrom above"
usern="resultfromabove"

View 11 Replies View Related

Programming :: Can't Pass Variables To A Program In Bash Script / Fix It?

Dec 30, 2010

Trying to do a simple bash script, and having some issues. I am relatively new to bash, and did my best to search, but idk what exactly to search for.

Doesn't work code...

View 6 Replies View Related

Programming :: Bash Script : Pass Arguments To Second Level Parser?

Jan 14, 2011

I wrote a C++ program that uses two different parsers. The first parser is reading program arguments from command line:./mybin arg1 arg2 ...then during program execution there's an interactive prompt asking for more parameters:

...
>> (second bunch of arguments here)
...

I'd like to run my program inside a bash script, but I don't know how to give the second level arguments.

View 2 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

Fedora :: Zenitiy Checklist In A Shellscript?

Nov 11, 2009

I am trying to evaluate the returning expression of a zenity checklis dialog.By creating the checklist. for example like this:retvalue=$(zenity --list --text "help me with the return value" --checklist ....and here the listI get some return likeapple | tree | cowHow would I now

if retvalue contains apple
commmand blabla
fi

[code]....

View 8 Replies View Related

General :: Accept Term Of Agreement In Shellscript?

Jan 17, 2010

i have to agree the term of agreement before runing it becase i want to automate my installation with a scripti have already tried "yes | ./myfile " but the problem is the agreement is more than one page and i need to hit space couple of times .. so it's not working .

View 7 Replies View Related

General :: Shell - Shellscript Combine All Files Without For Loop?

Jun 12, 2011

I have hundreds of files in one directory, is there a simple command or pipes of command I can use to append them together? I don't want to use any loops.

View 4 Replies View Related

Fedora :: Installing NVidia's Driver With Their Shellscript But It Didn't Work

Jan 10, 2011

I'm trying Fedora for the first time. I tried installing NVidia's driver with their shellscript but it didn't work for lots of reasons. Has anyone done this before?:[URL].. Does it work? I never used a distro with a package manager before. Aren't there several different drivers for different NVidia cards? How do the instructions in that link make you get the correct driver? And then does it create an /etc/X11/xorg.conf file?

EDIT: or is the Neaveau driver good enough already? I can't figure out if it's basically a finished product or not.

View 16 Replies View Related

Ubuntu :: Bash Shell - "t1" Will Pass To The X In "for X"?

Jun 6, 2011

I am trying to learn some script skills. I have seen such a bash shell: Code: for x do sed -f sedsrc $x > tmp.$x done then we can trigger the shell script from the command line: ./shell t1. My question is that it seems the "t1" will pass to the x in "for x"...

View 2 Replies View Related

General :: Getting Content-type/Mime Type Of The File Using Shellscript

May 24, 2011

I am copying the file form one directory to another directory using shellscript.

Here i want to get the Mimetype/Content-type of the file.

How to i can get the MimeType.

View 9 Replies View Related

Ubuntu :: Audio CD Extractor And VBR Parameters?

Mar 11, 2010

A couple of weeks ago I installed Karmic. In previous options in Audio CD Extractor I modified a string in the "edit preferences" to set the variable bit rate for MP3 ripping. Specically the option "VBR=4" (Lame New Algorthym) However, I now notice that the "VBR=" option is no longer there!

I've searched around and read some indications that using a newer realease of Lame this is no longer necessary. But its a bit unclear to me. Do I need to insert VBR=4 or not? and if I do anyway will it affect anything?

View 5 Replies View Related

Ubuntu :: How To Finetune Syndaemon Parameters

May 22, 2010

when one select System -> Preferences -> Mouse Preferences -> Touchpad -> Enable mouse clicks with touchpad, this results in sydaemon being started with the following parameters:

Code:
syndaemon -i 0.5 -k
while this is fine, for me the half second threshold seems to be too short, and I

[code]....

View 6 Replies View Related

Ubuntu Installation :: Kernel Parameters : How To Modify Them

Feb 4, 2010

Bottom line first: Is there a GUI or otherwise friendly tool to modify the kernel parameters? One that will give help on a highlighted parameters?

Now as to my reason for this question:

In preparing for an Informix installation, I may need to change some kernel parameters. I could follow the advice of G�rard BIGOT from a couple of years ago at this URL. However, messing with the kernel this way, by directly editing /etc/sysctl.conf, is a bit scary. I have already backed up the current one and started editing according the Informix machine notes. However, I have commented out my new settings. [:Chicken]

The scariest aspect of this is that the notes recommend settings to kernel parameters that I do not find in /proc/sys/kernel. for example, it recommends setting SHMMIN to 1 but when I can /proc/sys.kernel/shmmin, there is no such file. (I did find shmmax.) Similarly for the very logical shmseg (max number of shared memory segments) - not found. I am afraid to add these into sysctl.conf if the equivalent pseudo-files don't exist.

Additional question: Where [on-line] do I find all kernel parameters documented? This is so that I am more certain of what I am doing instead of relying on my memory. For example, I don't recall the names of the parameters that control Kernel-Asynchronous I/O (KAIO) events.

View 3 Replies View Related

Ubuntu :: Change The Background-image With Parameters?

May 31, 2010

I need to do a script to change the background image. I can do this with this command

PHP Code:

[Code]....

that work's fine but i need send some parameters to the background image

1)I need to set the style(mosaic, center, etc)

2)I need to set a color(because the image is smaller than the resolution)

I can't find how set this two parameters

View 2 Replies View Related







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