Sponsored Content
Top Forums Shell Programming and Scripting Save an specific part of a expect_out in a variable Post 302992678 by bebehnaz on Tuesday 28th of February 2017 01:12:42 PM
Old 02-28-2017
echo doesn't work with expect
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh: A part of variable A's name is inside of variable B, how to update A?

This is what I tried: vara=${varb}_count (( vara += 1 )) Thanks for help (4 Replies)
Discussion started by: pa3be
4 Replies

2. UNIX for Dummies Questions & Answers

Save contents of a Variable

I want to save the contents of a variable to a file. How can that be achieved? I have tried with: echo $varname > textfile.txt but for some reason it does not print anything. (1 Reply)
Discussion started by: carl_vieyra
1 Replies

3. Shell Programming and Scripting

Set specific part in command output into variable

I am trying unsuccessfully to set into a variable a specific part of command output: The command output will be as: line 1: <varied> line 2: 2 options: option 1: Set view: ** NONE ** or option 2: Set view: <different_name_of_views_always_without_spaces> and I would like to get into... (7 Replies)
Discussion started by: orit
7 Replies

4. Shell Programming and Scripting

Save output in a variable

Hi, I have a 3rd party tool on Solaris 8. I am running it thorugh my script but I am not able to capture its output into a variable. Like, I tried, but did not work. output=`/usr/bin/myTool` echo $output Also, I tried saving in a file but when I run, output is always shown on the... (19 Replies)
Discussion started by: angshuman_ag
19 Replies

5. Shell Programming and Scripting

expect_out buffer no such variable running script background

I am trying to use send and receive using expect. the expect_out(buffer) is working fine while it is running it as foreground. But the same script when it is ran as background, the expect_out(buffer) errored out. Is there any factor influence when we run script in foreground and in background? ... (0 Replies)
Discussion started by: shellscripter
0 Replies

6. Shell Programming and Scripting

find the line starting with a pattern and save a part in variable

Hi i have a file which has mutiple line in it. inside that i have a pattern similar to this /abc/def/hij i want to fine the pattern starting with "/" and get the first word in between the the symbols "/" i.e. "abc" in this case into a variable. thanks in advance (13 Replies)
Discussion started by: kichu
13 Replies

7. Shell Programming and Scripting

[Solved] Printing a part of the last line of the specific part of a file

Hi, I have 80 large files, from which I want to get a specific value to run a Bash script. Firstly, I want to get the part of a file which contains this: Name =A xxxxxx yyyyyy zzzzzz aaaaaa bbbbbb Value = 57 This is necessary because in a file there are written more lines which... (6 Replies)
Discussion started by: wenclu
6 Replies

8. Shell Programming and Scripting

A simpler way to do this (save a list of files based on part of their name)

Hello, I have a script that checks every file with a specific extension in a specific directory. The file names contain some numerical output and I am recording the file names with the best n outcomes. The script finds all files in the directory with the extension .out.txt and uses awk to... (12 Replies)
Discussion started by: LMHmedchem
12 Replies

9. UNIX for Dummies Questions & Answers

To count total of specific character in a file and save its value to a variable

Hi all, I have a file that contains characters. How do I get total of spesific character from that file and save the count to a variable for doing for calculation. data.txt 1 2 2 2 2 3 3 4 5 6 7 8 5 4 3 4 (5 Replies)
Discussion started by: weslyarfan
5 Replies

10. Shell Programming and Scripting

Bash to download specific files and save in two folders

I am trying to download all files from a user authentication, password protected https site, with a particular extension (.bam). The files are ~20GB each and I am not sure if the below is the best way to do it. I am also not sure how to direct the downloaded files to a folder as well as external... (7 Replies)
Discussion started by: cmccabe
7 Replies
IS_SUBCLASS_OF(3)							 1							 IS_SUBCLASS_OF(3)

is_subclass_of - Checks if the object has this class as one of its parents

SYNOPSIS
bool is_subclass_of TRUE (mixed $object, string $class_name, [bool $allow_string]) DESCRIPTION
Checks if the given $object has the class $class_name as one of its parents. PARAMETERS
o $object - A class name or an object instance. No error is generated if the class does not exist. o $class_name - The class name o $allow_string - If this parameter set to false, string class name as $object is not allowed. This also prevents from calling autoloader if the class doesn't exist. RETURN VALUES
This function returns TRUE if the object $object, belongs to a class which is a subclass of $class_name, FALSE otherwise. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.9 | | | | | | | Added $allow_string parameter | | | | | 5.3.7 | | | | | | | Added support for $class_name to work with | | | interfaces | | | | | 5.0.3 | | | | | | | You may also specify the $object parameter as a | | | string (the name of the class) | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 is_subclass_of(3) example <?php // define a class class WidgetFactory { var $oink = 'moo'; } // define a child class class WidgetFactory_Child extends WidgetFactory { var $oink = 'oink'; } // create a new object $WF = new WidgetFactory(); $WFC = new WidgetFactory_Child(); if (is_subclass_of($WFC, 'WidgetFactory')) { echo "yes, $WFC is a subclass of WidgetFactory "; } else { echo "no, $WFC is not a subclass of WidgetFactory "; } if (is_subclass_of($WF, 'WidgetFactory')) { echo "yes, $WF is a subclass of WidgetFactory "; } else { echo "no, $WF is not a subclass of WidgetFactory "; } // usable only since PHP 5.0.3 if (is_subclass_of('WidgetFactory_Child', 'WidgetFactory')) { echo "yes, WidgetFactory_Child is a subclass of WidgetFactory "; } else { echo "no, WidgetFactory_Child is not a subclass of WidgetFactory "; } ?> The above example will output: yes, $WFC is a subclass of WidgetFactory no, $WF is not a subclass of WidgetFactory yes, WidgetFactory_Child is a subclass of WidgetFactory Example #2 is_subclass_of(3) using interface example <?php // Define the Interface interface MyInterface { public function MyFunction(); } // Define the class implementation of the interface class MyClass implements MyInterface { public function MyFunction() { return "MyClass Implements MyInterface!"; } } // Instantiate the object $my_object = new MyClass; // Works since 5.3.7 // Test using the object instance of the class if (is_subclass_of($my_object, 'MyInterface')) { echo "Yes, $my_object is a subclass of MyInterface "; } else { echo "No, $my_object is not a subclass of MyInterface "; } // Test using a string of the class name if (is_subclass_of('MyClass', 'MyInterface')) { echo "Yes, MyClass is a subclass of MyInterface "; } else { echo "No, MyClass is not a subclass of MyInterface "; } ?> The above example will output: Yes, $my_object is a subclass of MyInterface Yes, MyClass is a subclass of MyInterface NOTES
Note Using this function will use any registered autoloaders if the class is not already known. SEE ALSO
get_class(3), get_parent_class(3), is_a(3), class_parents(3). PHP Documentation Group IS_SUBCLASS_OF(3)
All times are GMT -4. The time now is 07:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy