Sponsored Content
Full Discussion: Reuse Variable..
Top Forums Shell Programming and Scripting Reuse Variable.. Post 302401800 by abubacker on Monday 8th of March 2010 02:28:23 AM
Old 03-08-2010
MySQL Solution

Do u mean if u change the value of the cv variable then u want the value of the filename also be changed automatically. with out giving this line
Code:
file_name="$(echo "CP99978_$cv.TXT")"

Correct me If im wrong?





---------- Post updated at 02:28 AM ---------- Previous update was at 02:27 AM ----------

If ur facing a reference problem then
I think you can solve your problem by referring the following snippet
Code:
function setToXXX() {
  echo changing value of $1
    eval "$1='$FOO'"
    }

    FOO=hello
    BAR=$FOO ;
    echo function, FOO is $FOO
    echo function, BAR is $BAR

    echo "FOO IS CHANGING" ;
    FOO="CHANGED VALUE" ;
    setToXXX BAR # you must call this function 

    echo after function, BAR is $BAR

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to reuse same major number

Hi, I am working on device drivers.Once If register a device i'll get one major no. If i unregister and register again i'll get a different major no.What i have to do to get same major no. each time :( (0 Replies)
Discussion started by: Agnello
0 Replies

2. UNIX for Advanced & Expert Users

Password reuse utility

Does anyone know of a password reuse utility for Solaris 7 or 8? Security people are telling me that I need one. Thanks (1 Reply)
Discussion started by: rtoba
1 Replies

3. HP-UX

Reuse disk from other HP-UX

Hello, I have 2 hp-ux both running 11.23, I have move one of a harddisk from "UNIX A" to "UNIX B", so how can I read back the data in "UNIX B"? Thanks (5 Replies)
Discussion started by: zetadhell
5 Replies

4. Linux

suggest some ideas for reuse

hi can you all help me to develop anything in unix that could be reused. any module or application could be helpful (0 Replies)
Discussion started by: infyanurag
0 Replies

5. UNIX for Dummies Questions & Answers

Reuse argument from current command?

I'm currently using zsh. Sometimes I find myself wishing to reuse an argument from earlier in the command. I know that I can, of course, assign an argument to a variable ahead of time, and then easily use that variable more than once. I know about the ability to reuse arguments from previous... (0 Replies)
Discussion started by: marshaul
0 Replies

6. Shell Programming and Scripting

How to declare variables once and reuse them in other scripts?

Hello everyone. I'm trying to create a conf file with variables that my other scripts will use. I have several scripts that use the same variables, and since I don't know how to read them from an external file, i define them in each script (and then if i want to change one's value i need to... (4 Replies)
Discussion started by: moshe88
4 Replies

7. Emergency UNIX and Linux Support

Reuse a LUN

I have a LUN (From HP-Storage VA7110) that is claimed on 2 servers, but is in used in one of the VG on Server-1 . Now I want to shut Server-1 and re-use that LUN on server-2 . Server-1 Path-1 : /dev/rdsk/c4t0d1 Path-2: /dev/rdsk/c6t0d1 Server-2 Path-1: /dev/rdsk/c5t0d1 Path-2:... (8 Replies)
Discussion started by: Shirishlnx
8 Replies

8. Shell Programming and Scripting

How to reuse values in Shell script

Hi I am trying to write a shell script and wanted to re-use the value which I have entered already. Here is the sample code. echo "Enter Value : \c" ; read val echo "Enter number: $val\c" ; read num Now I wanted to change the value as showing in 2nd Line or if I will use enter, it... (15 Replies)
Discussion started by: SushilAnand
15 Replies

9. Solaris

Reuse old/configured server for new purpose problems.

Greetings. First of all I consider myself a newbe in Linux, that's why I'm seeking your help so please be patient! I was given an old server (Solaris) that has Oracle (10.2.0) installed with a few databases. I'm supposed to reuse this server for this new application which will process data... (11 Replies)
Discussion started by: RedSpyder
11 Replies

10. Programming

Reuse format strings

I have a collection of format strings for sscanf, such as "%02d%*1s%02d%*1s%02d" to read in certain formatted strings, such as dates, times, etc. I wonder if there is a way to use them in printf without some changes? The example above would not work - at least I can't think of any ways to... (4 Replies)
Discussion started by: migurus
4 Replies
Perl::Critic::Utils::PPI(3)				User Contributed Perl Documentation			       Perl::Critic::Utils::PPI(3)

NAME
Perl::Critic::Utils::PPI - Utility functions for dealing with PPI objects. DESCRIPTION
Provides classification of PPI::Elements. INTERFACE SUPPORT
This is considered to be a public module. Any changes to its interface will go through a deprecation cycle. IMPORTABLE SUBS
"is_ppi_expression_or_generic_statement( $element )" Answers whether the parameter is an expression or an undifferentiated statement. I.e. the parameter either is a PPI::Statement::Expression or the class of the parameter is PPI::Statement and not one of its subclasses other than "Expression". "is_ppi_generic_statement( $element )" Answers whether the parameter is an undifferentiated statement, i.e. the parameter is a PPI::Statement but not one of its subclasses. "is_ppi_statement_subclass( $element )" Answers whether the parameter is a specialized statement, i.e. the parameter is a PPI::Statement but the class of the parameter is not PPI::Statement. "is_ppi_simple_statement( $element )" Answers whether the parameter represents a simple statement, i.e. whether the parameter is a PPI::Statement, PPI::Statement::Break, PPI::Statement::Include, PPI::Statement::Null, PPI::Statement::Package, or PPI::Statement::Variable. "is_ppi_constant_element( $element )" Answers whether the parameter represents a constant value, i.e. whether the parameter is a PPI::Token::Number, PPI::Token::Quote::Literal, PPI::Token::Quote::Single, or PPI::Token::QuoteLike::Words, or is a PPI::Token::Quote::Double or PPI::Token::Quote::Interpolate which does not in fact contain any interpolated variables. This subroutine does not interpret any form of here document as a constant value, and may not until PPI::Token::HereDoc acquires the relevant portions of the PPI::Token::Quote interface. This subroutine also does not interpret entities created by the Readonly module or the constant pragma as constants, because the infrastructure to detect these appears not to be present, and the author of this subroutine (not Mr. Shank or Mr. Thalhammer) lacks the knowledge/expertise/gumption to put it in place. "is_subroutine_declaration( $element )" Is the parameter a subroutine declaration, named or not? "is_in_subroutine( $element )" Is the parameter a subroutine or inside one? "get_constant_name_element_from_declaring_statement($statement)" This subroutine is deprecated. You should use "get_constant_name_elements_from_declaring_statement()" in PPIx::Utilities::Statement instead. Given a PPI::Statement, if the statement is a "use constant" or Readonly declaration statement, return the name of the thing being defined. Given use constant 1.16 FOO => 'bar'; this will return "FOO". Similarly, given Readonly::Hash my %FOO => ( bar => 'baz' ); this will return "%FOO". Caveat: in the case where multiple constants are declared using the same "use constant" statement (e.g. "use constant { FOO => 1, BAR => 2 };", this subroutine will return the declaring PPI::Structure::Constructor. In the case of "use constant 1.16 { FOO => 1, BAR => 2 };" it may return a PPI::Structure::Block instead of a PPI::Structure::Constructor, due to a parse error in PPI. "get_next_element_in_same_simple_statement( $element )" Given a PPI::Element, this subroutine returns the next element in the same simple statement as defined by is_ppi_simple_statement(). If no next element can be found, this subroutine simply returns. If the $element is undefined or unblessed, we simply return. If the $element satisfies "is_ppi_simple_statement()", we return, unless it has a parent which is a PPI::Structure::List. If the $element is the last significant element in its PPI::Node, we replace it with its parent and iterate again. Otherwise, we return "$element->snext_sibling()". "get_previous_module_used_on_same_line( $element )" Given a PPI::Element, returns the PPI::Element representing the name of the module included by the previous "use" or "require" on the same line as the $element. If none is found, simply returns. For example, with the line use version; our $VERSION = ...; given the PPI::Token::Symbol instance for $VERSION, this will return "version". If the given element is in a "use" or <require>, the return is from the previous "use" or "require" on the line, if any. AUTHOR
Elliot Shank <perl@galumph.com> COPYRIGHT
Copyright (c) 2007-2011 Elliot Shank. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.16.3 2014-06-09 Perl::Critic::Utils::PPI(3)
All times are GMT -4. The time now is 09:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy