02-18-2007
Dynamic Agrument while running a script
Hi Gurus,
I am tryin to get the nth argument/parameter ( n being calculated in runtime).
I want to assign tghis value to a variable say myvar. How do i do it? I am struggling to get proper escape chars in place.
e.g. Say my script name is myscript.sh
I will run the script by typing $myscript.sh abc def ghi
In the script i have a variable n which wil indicate which parameter to pic up and myvar should contain this parameter.
Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have to create a global dynamic script which should ask for the env or some other variables and then create the soft links.
let's say that I have to create ten soft links and the path for these soft links is different for each env
for e.g:
WDEV: /d02/app/applmgr/wdev/appl/CDCRM/bin... (2 Replies)
Discussion started by: isingh786
2 Replies
2. Shell Programming and Scripting
Hi Gurus,
I have a requirement of writting the shell script where it should ask me two values
FND_TOP=/d02/app/oracle/xxx/fnd/11.5.0
CDCRM_TOP=/d02/app/oracle/xxx/cdcrm/11.5.0
and then keep these values stored as variables for the execution of rest of the script.
Because, I have to... (2 Replies)
Discussion started by: isingh786
2 Replies
3. UNIX for Advanced & Expert Users
I have a file that reads File (X.txt)
Contents of record 1:
rdrDESTINATION_ADDRESS (String) "91 971502573813"
rdrDESTINATION_IMSI (String) "000000000000000"
rdrORIGINATING_ADDRESS (String) "d0 movies"
rdrORIGINATING_IMSI (String) "000000000000000"
rdrTRAFFIC_EVENT_TIME... (0 Replies)
Discussion started by: magedfawzy
0 Replies
4. Shell Programming and Scripting
I need to run a shell script with dynamic command in it like
# Begin script...
mysql xx "select * from tab" | sed 's/\t/|/g' > GENERATED_20100304.txt
the dynamic part is 20100304 which should be today's date, and it needs to run every day and create a new file with... (2 Replies)
Discussion started by: nuthalapati
2 Replies
5. Shell Programming and Scripting
Hi All,
I am stuck in a situation where there is a script, say test1.tcsh which is being called from another script ,say test2.tcsh
test1.tcsh:-
#!/usr/local/bin/tcsh
echo -n "Do you wanna test ??"
set answ = $<
echo $answ
if ($answ =~ "y") then
echo -n "enter your name <"
... (1 Reply)
Discussion started by: kavyak
1 Replies
6. Shell Programming and Scripting
Hey there, first post, somewhat-long-time lurker-
This is on a Red Hat box
Im working on a new site, and I have an idea for a dynamic CGI script to change who is "on call"
Pretty much, it would pull next name from a text file each week to display it on the site, and just keeps cycling through... (3 Replies)
Discussion started by: rapenchukd
3 Replies
7. Shell Programming and Scripting
I am currently running 2 scripts to gather data for a 3rd script and would like to combine the 2 scripts into one. Having issues with the final output format.
Note cannot post URL so replaced the http stuff with (name) in the examples
All scripts contain #!/bin/ksh OS = Red Hat Enterprise... (0 Replies)
Discussion started by: pcpinkerton
0 Replies
8. HP-UX
Hi everyone, im try to write a small script to do something like this
new_find.sh#!/usr/bin/ksh
PAR=$1
PATH1=$2
find $PATH1 -name $PAR
i need to pass the mask of the find by parameter but this dont work
sh new_find *.sql /home/somthing
any tip ?
thanks! (3 Replies)
Discussion started by: lucasmanson
3 Replies
9. Shell Programming and Scripting
Hello friends,
I have a script.sh running, i need to move his generated file to another path and restart it every 24h.
is there a way to restart it from a script in a dynamic way without create a duplicate process?
script.sh &
mv file to /path
script.sh & many thanks for your help (7 Replies)
Discussion started by: kraterions
7 Replies
10. Shell Programming and Scripting
Dears,
#!/bin/bash
func1()
{
echo "func1"
}
func2()
{
echo "func2"
}
func3()
{
echo "func3"
} (5 Replies)
Discussion started by: sadique.manzar
5 Replies
LEARN ABOUT PHP
stream_wrapper_register
STREAM_WRAPPER_REGISTER(3) 1 STREAM_WRAPPER_REGISTER(3)
stream_wrapper_register - Register a URL wrapper implemented as a PHP class
SYNOPSIS
bool stream_wrapper_register (string $protocol, string $classname, [int $flags])
DESCRIPTION
Allows you to implement your own protocol handlers and streams for use with all the other filesystem functions (such as fopen(3), fread(3)
etc.).
PARAMETERS
o $protocol
- The wrapper name to be registered.
o $classname
- The classname which implements the $protocol.
o $flags
- Should be set to STREAM_IS_URL if $protocol is a URL protocol. Default is 0, local stream.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
stream_wrapper_register(3) will return FALSE if the $protocol already has a handler.
CHANGELOG
+--------+------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+------------------------------+
| 5.2.4 | |
| | |
| | Added the $flags parameter. |
| | |
+--------+------------------------------+
EXAMPLES
Example #1
How to register a stream wrapper
<?php
$existed = in_array("var", stream_get_wrappers());
if ($existed) {
stream_wrapper_unregister("var");
}
stream_wrapper_register("var", "VariableStream");
$myvar = "";
$fp = fopen("var://myvar", "r+");
fwrite($fp, "line1
");
fwrite($fp, "line2
");
fwrite($fp, "line3
");
rewind($fp);
while (!feof($fp)) {
echo fgets($fp);
}
fclose($fp);
var_dump($myvar);
if ($existed) {
stream_wrapper_restore("var");
}
?>
The above example will output:
line1
line2
line3
string(18) "line1
line2
line3
"
SEE ALSO
The "streamWrapper" prototype class, "Example class registered as stream wrapper", stream_wrapper_unregister(3), stream_wrapper_restore(3),
stream_get_wrappers(3).
PHP Documentation Group STREAM_WRAPPER_REGISTER(3)