Once again as we have no idea about your shell scripts nor commands then I have
created a very dirty example using a shell script generated on the fly awaiting a
physical "y" to be entered and an automatic "n" later, done longhand...
You will have to work out any subtleties, loops etc for yourself...
Code:
#!/bin/bash --posix
# An example ONLY...
> /tmp/Y
echo "Test for a remote Y on another shell script..."
echo -n "Enter y to continue:- "
read y
echo -n "$y" > /tmp/Y
echo -e "read wait_for_yes < /tmp/Y" > /tmp/test.sh
echo -e 'if [ "$wait_for_yes" == "y" ]' >> /tmp/test.sh
echo -e "then" >> /tmp/test.sh
echo -e " echo 'Y was detected...'" >> /tmp/test.sh
echo -e "fi" >> /tmp/test.sh
echo -e 'if [ "$wait_for_yes" == "n" ]' >> /tmp/test.sh
echo -e "then" >> /tmp/test.sh
echo -e " echo 'Auto N was detected...'" >> /tmp/test.sh
echo -e "fi" >> /tmp/test.sh
chmod 755 /tmp/test.sh
echo -e "Launch this command test.sh...\n"
/tmp/test.sh
echo -e "\nReturn back to the calling shell...\n"
echo "Check using N for the remote entry but not inputted manually..."
echo -e "Launch this command test.sh...\n"
echo -n "n" > /tmp/Y
/tmp/test.sh
echo -e "\nReturn back to the calling shell..."
rm /tmp/Y
Results on OSX 10.7.5, default bash terminal...
Code:
Last login: Sat Nov 16 23:41:57 on ttys000
AMIGA:barrywalker~> chmod 755 auto-yes.sh
AMIGA:barrywalker~> ./auto-yes.sh
Test for a remote Y on another shell script...
Enter y to continue:- y
Launch this command test.sh...
Y was detected...
Return back to the calling shell...
Check using N for the remote entry but not inputted manually...
Launch this command test.sh...
Auto N was detected...
Return back to the calling shell...
AMIGA:barrywalker~> _
I have wrriten a script to call sql script to do some work in database. However, the script couldn't be executed. The only information was: ksh: ./updt_attrib.ksh cannot execute. Please help me to identify where the problem is. I post script here for your reference. Thanks a lot.
#!/bin/ksh
... (8 Replies)
i'm writing some simple scripts to help me learn perl.
why does the print command get called after the shell script is executed?
the purpose of the shell script is to simply echo to the screen "script run". which is does, but before the print command, you can clearly see the shell script is... (3 Replies)
Hello Everybody,
Please help.
I was trying to automate the use of a third-party given shell script. The script is written to be used at run-time to collect a few variables to be provided by the user through key board, in the fashion as below:
./runcommand
please provide a file name to... (6 Replies)
hi,
i have to send an email once a day at ceratin time say 22.
i have tried with date commad, but not working.:(
HOUROFTHEDAY=`date +'%H'`
if ; then
mailx -s "Info" emailid@org.com < $ProcessStatisticsFile
fi
Please help me... (5 Replies)
i used a two-way linked list "node" for the code::
#include<stdio.h>
#include<malloc.h>
void insert();
void reverse();
struct node
{
char c;
struct node *next;
struct node *back;
}*start=NULL;
int main()
{
int n,i; (4 Replies)
I am trying to automate a testcase . I am installing some software and it waits for user input after displaying "Do you want to continue ? " I am trying to do this in shell scripting.
#!/bin/bash
#!/usr/bin/expect -f
/usr/bin/expect << EOF
spawn apt-get install openjdk-7-jdk
expect "*Do you... (1 Reply)
I am able to execute awk command from shell prompt. but the same command is not getting executed when written and run in a bash script
the command from bash cmd prompt.
awk '/world/{for (i=2; i<NF; i++) printf $i " "; print $NF}1' myfile >tmp$$ ; mv tmp$$ myfile
file:
# hello world my... (4 Replies)
Here I am in a position to write a Unix Shell script(.sh) to remove MongoDB collection documents. I know how to remove based on a condition like below and it works for me.
eval 'db.Collection.remove({TimeStamp:{$lte: "'$var'"}})
But I need to change the remove statement based on a new parameter... (1 Reply)
Hi All,
I am trying to write a shell script to check if a command executed successfully or not in rhel 7 and finding the installed tomcat version.
I am using below script.
var4=$(find / -name "catalina.jar" ! -size 0 |egrep -v... (6 Replies)
Discussion started by: sravani25
6 Replies
LEARN ABOUT PHP
forward_static_call
FORWARD_STATIC_CALL(3) 1 FORWARD_STATIC_CALL(3)forward_static_call - Call a static methodSYNOPSIS
mixed forward_static_call (callable $function, [mixed $parameter], [mixed $...])
DESCRIPTION
Calls a user defined function or method given by the $function parameter, with the following arguments. This function must be called
within a method context, it can't be used outside a class. It uses the late static binding.
PARAMETERS
o $function
- The function or method to be called. This parameter may be an array, with the name of the class, and the method, or a string,
with a function name.
o $parameter
- Zero or more parameters to be passed to the function.
RETURN VALUES
Returns the function result, or FALSE on error.
EXAMPLES
Example #1
forward_static_call(3) example
<?php
class A
{
const NAME = 'A';
public static function test() {
$args = func_get_args();
echo static::NAME, " ".join(',', $args)."
";
}
}
class B extends A
{
const NAME = 'B';
public static function test() {
echo self::NAME, "
";
forward_static_call(array('A', 'test'), 'more', 'args');
forward_static_call( 'test', 'other', 'args');
}
}
B::test('foo');
function test() {
$args = func_get_args();
echo "C ".join(',', $args)."
";
}
?>
The above example will output:
B
B more,args
C other,args
SEE ALSO forward_static_call_array(3), call_user_func_array(3), call_user_func(3), is_callable(3), information about the callback type.
PHP Documentation Group FORWARD_STATIC_CALL(3)