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


ADVERTISEMENT

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 That Reads From Parameters File?

Nov 3, 2009

what I am trying to do but I am not sure exactly how to do it. I want to write a shell script that will replace certain values in a file with environment specific information that it pulls from a parameters file. The paramaters file looks like the following...

[dev]
ip=10.15.109.41
name=dev1.mydomain.com

[code]...

View 4 Replies View Related

General :: Pass File Content Through URL Using Shell Script?

Jul 16, 2011

I am calling a URL from shell script and passing few argumants,Here i have to pass file content as one argument.How can i pass file content through URL.

eg:
content=`cat /Users/test1.txt`
open http://localhost:8080?filecontent=$content

[code],...

View 1 Replies View Related

Programming :: Grep Multiple Values In Single Pass Through Log File?

Nov 13, 2010

I have a huge binary log file. There are lets say 4 id's that I want to find in a log file. I know that those 4 id's will be present in the log file and I also know in what order they will be present. I want to find 1st id from the log then 2nd id and then third id and so on..

Simple/inefficient solution is: Loop through the id's and then grep in the log file. Problem with this solution is for each id grep will search from the beginning of the file.

Better/efficient solution would be: Sine I know the order in which id's will be present in the log file. Loop through id's, grep 1st id and then move on to grep 2nd id and so on...this way I can grep all id's in one pass. Is this solution possible ?

I have 500000 + values to find in log files and I have to find efficient solution for it.

View 2 Replies View Related

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

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

Programming :: Writing Unix Shell Script To Pass File Name/path/creation Date?

Oct 7, 2009

I'm new to UNIX scripting; I�m stuck with the following I have an Oracle SQL script that takes three parameters

1- File Name
2- File Path
3- File creation date

Under UNIX I have a folder where files will be placed frequently and I need to upload those files to Oracle, what I need is a UNIX script that can do the following

Loop through Directory "/home/applmgr/snktmp"
Picks only files
Pass the file name to parameter &1

[code]....

Is the above possible? I already knows how to call the Oracle Script from UNIX Im only stuck on writing the UNIX part where it List the files attribute(name,path,date) and store them to parameters ,Looping until the last file in the directory If the above is not possible,then how can I create the below from the command line

Filename{concatenation Mark}filePath{concatenation Mark}creationdate
Filename{concatenation Mark}filePath{concatenation Mark}creationdate
Filename{concatenation Mark}filePath{concatenation Mark}creationdate
Filename{concatenation Mark}filePath{concatenation Mark}creationdate

View 4 Replies View Related

General :: Shell Scripting: Parse Parameters From Command Line?

Mar 12, 2010

myscript [-a a-arg] [-c c-arg] [-b] [-e] somedirectory

Given that I want my shell script be invoked at the command line using the above parameters - where [these brackets] denote that they are optional - what is the best method to parse them?

View 1 Replies View Related

General :: Wrapper For Unix Command With Multiple Parameters

Jan 7, 2011

I hope to add a wrapper script for the command with different parameters. For example, for any Unix command or script, like below:
command.sh -s p1 -o p2 -q p3
or
command.sh

Probably we could do as this way
cat wrapper
$1 $2 $3 $4 $5 $6 $7 | tee test.log
(assume it has 0 to 6 parameters)

and use it like
wrapper command.sh -s p1 -o p2 -q p3
wrapper command.sh

It is a little ugly to list all fixed parameter as above, do we have better code to handle various parameters?

View 4 Replies View Related

Programming :: Write A Replacement For Shell Command Line Interpreter?

Sep 2, 2010

If say, I want to read the input given by user at the command prompt and write a code to execute the cmd given then which commands do i use to implement this ( Im writing the code in C )?

View 8 Replies View Related

General :: Custom TCP Parameters For Multiple Interfaces - Change The Default Values

Feb 16, 2011

My question is about TCP parameters in Linux. By now, I want to change the default values of:

Initial Timeout
ACK Delay
Idle Connection Timeout

I have a Linux Box with kernel 2.6.x and 2 ethernet interfaces. I know TCP is a stack that doesn't have anything to do with ethernet devices. Said that, the question: is there a way to set custom values for each interface? For example, a server listening to connections in eth0 would use one value for Idle Connection Timeout and another server listening to connections in eth1 could use a different value for that parameter.

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

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

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

Programming :: Access Grub Parameters Using Shell Scripts?

Apr 12, 2010

I am setting up my test / development machine with the following scenario in mind : I boot the machine and then select one of a number ( e.g. 3 ) boot options in Grub ( Normally "OpenSuse", "Safe Mode" etc., but in this case "System Restore Dev.", "System Restore Test" ). The only difference between these options are the settings ( e.g. "vga=378" ) in these cases something like "distro=dev" / "distro=test".

In a script run on the booted system I can extract the value of the "distro" parameter ( in this case "test" ) and use it as input for a command line tool. Meaning that name entered as the value for the "distro" parameter is used for loading a file when the system is up and running. The command line tool then restores the partition with the contents of the file and reboots the system.Now, my problem is this : How to I access the Grub arguments? Code snippets ( in shell scripting or python preferbly ) are more than welcome.

View 10 Replies View Related

Software :: Bad ELF Interpreter / No Such File Or Directory?

Jul 11, 2011

Starting sshd: /etc/init.d/sshd: /usr/sbin/sshd: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

---------- Post added 07-11-11 at 01:29 AM ----------

and btw i have install al glibc.x86_64

uname -m
x86_64

View 1 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 :: How To Pass Sed Address By Shell Variable

Aug 2, 2011

Code...

I am somewhat confident that there is a neater way.

Question: Does anybody know the answer?

View 3 Replies View Related

Programming :: Pass A Shell Variable To An AWK Command?

Dec 23, 2010

I have the following code :

Code:
E_BADARGS=65
if [ $# -ne 2 ] ; then

[code]...

View 1 Replies View Related

Programming :: Pass Variable From One Shell Script Into Another

Oct 2, 2009

I have some messy code that I wrote a while back and I am trying to organize it. The program opens xpaint and uses xwit and xte to draw packman and so on. I want to split it all up I am going to add more to it. Basically like i would want drawing packman in one function i guess you could call it and then coloring him or the background in another

<code>
#!/bin/bash
pkill xpaint
res=`xwininfo -root | grep geom | sed -e 's/^.*try ([0-9][0-9]*x[0-9][0-9]*)+.*$/1/'`
Xoriginal=`echo $res | cut -d 'x' -f 1`
Yoriginal=`echo $res | cut -d 'x' -f 2`

X=`echo "($Xoriginal/2)-400" | bc `
Y=`echo "$Yoriginal/2" | bc `
#t=$(($Y/2))
bob=`echo "$Y/2" |bc `
echo $X
echo $Y

/usr/bin/xpaint -size "$Xoriginal"x"$Yoriginal" -popped &
sleep 4
paintersMom=`xwit -all -print | grep XP | cut -d ":" -f 1`
canvasWin=`xwit -all -print | grep Untitled | cut -d ":" -f 1`
#toolres=`xwininfo -id $paintersmom | grep geom | sed -e 's/^.*try ([0-9][0-9]*x[0-9][0-9]*)+.*$/1/'`
#canres=`xwininfo -id $canvasWin | grep geom | sed -e 's/^.*try ([0-9][0-9]*x[0-9][0-9]*)+.*$/1/'`

#echo $paintersMom
xwit -id $paintersMom -move 0 0
xwit -id $canvasWin -move 0 0
xwit -root -warp "$X" "$Y"
sleep 4
for((i=45; i < 315; i++))
do
xte 'mousedown 1'
ang=`./deg2rad $i`

movex=`echo "$X+$bob*c($ang)" | bc -l`
movey=`echo "$Y+$bob*s($ang)" | bc -l`
xwit -root -warp "$movex" "$movey"
done
xwit -root -warp "$X" "$Y"
xte 'mouseup 1'

#xwit -id $paintersMom -focus -raise
#sleep 1
#xwit -id $paintersMom -warp 30 390 #// fill in command on tool bar
#sleep 1
#xte 'mouseclick 1'
#sleep 1
#xwit -id $canvasWin -warp 221 40 #// color selection
#sleep 1
#xte 'mouseclick 1'
#sleep 1
#xwit -id $canvasWin -warp "$(($X-150))" "$Y" #//location on pac man
#sleep 1
#xte 'mouseclick 1'
#sleep 1

#xwit -id $canvasWin -warp 62 44 #// selecting color black
#sleep 1
#xte 'mouseclick 1'
#sleep 1
#xwit -root -warp 62 120 #// selecting back to canvas
#sleep 1
#xte 'mouseclick 1' #// color canvas black
#sleep 1
#xwit -id $paintersMom -focus -raise
#xwit -id $paintersMom -warp 27 108 #//click back to pencil
#sleep 1
#xte 'mouseclick 1'
#sleep 1
</code>

Here for example $paintersmom is would be in the drawing of pacman but I would also want to use it when I colored him in.. but I would want both processes in a different shell script.

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

Fedora :: Real Player / Error Bad ELF Interpreter: No Such File Or Directory?

Dec 18, 2010

I am using fedora 14 and after i have installed RealPlayer11GOLD.rpm , i didnot work and it give me the following error

./realplay: /opt/real/RealPlayer/realplay.bin: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

View 14 Replies View Related

General :: Fetch File From There (which Is .tar.gz) And Pass It Directly To Tar Command?

Jun 25, 2010

I have access to backup server via rsync protocol (only rsync, nothing else). Now, I want to fetch file from there (which is .tar.gz) and pass it directly to tar command, without saving the archive in local filesystem. To visualize, with ssh access I could:

ssh remote_host cat backup.file.tar.gz | tar xzf - And I will get uncompressed backup locally, without actually storing .tar.gz on local machine. Is it possible to achieve when using rsync?

View 4 Replies View Related

General :: Pass A Paramter To A List Of Command In Another File?

Apr 19, 2010

I am attempting to write my first ever script from scratch and making some progress.

My first shell script file executes a list of commands contained in a second file. I need to pass a parameter to this command file how do I do this?

View 7 Replies View Related

CentOS 5 :: Pass Shell As Command Line Argument When I Ssh To An Account

Jan 25, 2011

I want to have a choice or more preferable pass shell as command line argument when I ssh to an linux account.i.e. If John logs in to account "zzz" on server "abc", by default definition of account "zzz" n server "abc" he get csh.But Sally desires that when she logs in to account "zzz" on server "abc", she needs the login shell to be ksh,and Rick wants bash when he logs in to account "zzz" on server "abc".What is the most non-intrusive / easiest way to achieve this? Each user can set their preference on ssh command line or create a simple alias by each shell, but not sure how to do this.

View 6 Replies View Related

Programming :: Script To Pass Multiple Files To Program?

Feb 8, 2011

I'm playing around with a bash script to pass files to a program (such as VLC). I thought something like this would work:

vlc $( ls | sed 's/ /\ /g' | tr '
' ' ' )

ls shows the files in the current directory, then sed changes spaces to " " (to escape them) and finally tr removes the line breaks. I end up changing:

01 - Music Track.mp3
02 - Another Track.mp3
to

01 - Music Track.mp3 02 - Another Track.mp3

"vlc 01 - Music Track.mp3 02 - Another Track.mp3" works if I type it manually but my script reports a problem with `-'

It seems it's not escaping the spaces.

View 4 Replies View Related

General :: Count Multiple Objects In Shell Script?

Jul 21, 2010

Trying to count the number of oracle instances on HPUX 11.23 - using ksh. I have multiple instances running and I would like to have a count for how many processes for eachinstance.Example, run the 'ps -efu oracle' command and for each instance increment a counter. So I am looking forINT1=# INT2=# INT3=# ... INTn=#I keep thinking a 'do-while' or some type of 'while' loop but I am missing something, somewhere

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







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