Sponsored Content
Top Forums Shell Programming and Scripting Export variables to subshells Post 302982577 by Juha Nurmela on Friday 30th of September 2016 10:41:37 AM
Old 09-30-2016
Third might be
Code:
 $ content='echo $aa'
 $ aa=hep                 
 $ eval $content
hep
 $

Juha

But an exit within content probably breaks things
This User Gave Thanks to Juha Nurmela For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

export variables

I have a master shell, which calls another shell to export some env variables. But when I just run the child shell from the command line, and see if the variables are exported by doing, echo $EXPORTED_VAR1 I am not seeing the value. But I am sure, I am using the child shell from a master... (4 Replies)
Discussion started by: srishan
4 Replies

2. Shell Programming and Scripting

export env variables

hi i want to write a shell script to set environment variables . But i am not been able to set that for the current shell instead i have to spawn a new shell. Is there a way to set the env variable for the current shell using shell script in bash shell ? Thnx (2 Replies)
Discussion started by: varun.81
2 Replies

3. Shell Programming and Scripting

script to export variables

Hi, I am a newbie to unix as well as scripting. I need to write a script, which on execution sets the necessay oracle variables. Can someone help me out as to how to proceed? also can u suggest good tutorial for bash/shell scripting? thanks (1 Reply)
Discussion started by: aboxilica
1 Replies

4. Solaris

not able to export the Variables

I am working with Sun Solaris 9 and I want to export the environment variable from my application(xxxx.ksh) but I am not able to see it when I am using SET command I am writing some variables which I have to set COMMON_USER_HOME=${HOME} export COMMON_USER_HOME echo... (6 Replies)
Discussion started by: smartgupta
6 Replies

5. UNIX for Advanced & Expert Users

How to export ENV variables, which remains set for all the shell

Hi ! How to export ENV variables, which remains set for all the shell Example :- Login :myID Pwd : **** -> Here my ID .profile is executed. Let say I set MYENV variable Kisses% rlogin ABC -l XXXGroupID -> I login into a remote Solaris Server ABC password : **** -> "XXXGroupID's... (1 Reply)
Discussion started by: dashok.83
1 Replies

6. UNIX for Advanced & Expert Users

Bash script with export variables

Hi all guys, how you can read in thread title, I'm deploying a bash script in which I have to export some variables inside it. But (I think you know) the export command works only inside the script and so, on exit command, the variables aren't set like I set inside the script. Consequently in... (8 Replies)
Discussion started by: idro
8 Replies

7. Shell Programming and Scripting

Columns Built in awk Variables don't export

I need to export the built in awk variables for columns so that they are available for the rest of the script. This is what I have so far: cat /tmp/test | eval `awk '{print "export NAME="$1; print "export NAME2="$2;}'` echo Host is "$NAME" and Host2 is "$NAME2" When I run bash -x to... (2 Replies)
Discussion started by: newbie2010
2 Replies

8. Shell Programming and Scripting

Read variables from a file and then export it.

Hi I want to read variables from one file and then set it as environment variable; The text file is test.txt which contains SPEED:1000 IP:172.26.126.11 My code is: while read line; do var1=`echo $line | awk 'BEGIN {FS=":"} { print $1 }'` echo $var1 var2=`echo $line | awk 'BEGIN {FS=":"}... (8 Replies)
Discussion started by: SSM
8 Replies

9. UNIX for Dummies Questions & Answers

Understanding the concept behind subshells

Can someone post a "for dummies" explanation on how subshells work? Let's say I want to get a couple of pieces of info from the /etc/passwd file and set them as variables to be echo'd back after all data is gathered. something like for i in ${grep 5000 /etc/passwd | cut -d : -f 5}... (5 Replies)
Discussion started by: flyboynm
5 Replies

10. Shell Programming and Scripting

Array - Export/Import in global environment variables.

Hello. During startup /etc/bash.bashrc.local generates some array ..... source /.../.../system_common_general_array_env_var ..... The file system_common_general_array_env_var contains : LEAP_VERSION='42.3' ARRAY_MAIN_REPO_LEAP=('zypper_local' 'openSUSE-Leap-'"$LEAP_VERSION"'-Non-Oss' ... (2 Replies)
Discussion started by: jcdole
2 Replies
Mail::Message::Body::Construct(3pm)			User Contributed Perl Documentation		       Mail::Message::Body::Construct(3pm)

NAME
Mail::Message::Body::Construct - adds functionality to Mail::Message::Body DESCRIPTION
This package adds complex functionality to the Mail::Message::Body class. This functions less often used, so many programs will not compile this package. METHODS
Constructing a body $obj->attach(MESSAGES, OPTIONS) Make a multipart containing this body and the specified MESSAGES. The options are passed to the constructor of the multi-part body. If you need more control, create the multi-part body yourself. At least take a look at Mail::Message::Body::Multipart. The message-parts will be coerced into a Mail::Message::Part, so you may attach Mail::Internet or MIME::Entity objects if you want --see Mail::Message::coerce(). A new body with attached messages is returned. example: my $pgpkey = Mail::Message::Body::File->new(file => 'a.pgp'); my $msg = Mail::Message->buildFromBody( $message->decoded->attach($pgpkey)); # The last message of the $multi multiparted body becomes a coerced $entity. my $entity = MIME::Entity->new; my $multi = $msg->body->attach($entity); # Now create a new message my $msg = Mail::Message->new(head => ..., body => $multi); $obj->concatenate(COMPONENTS) Concatenate a list of elements into one new body. Specify a list of text COMPONENTS. Each component can be a message (Mail::Message, the body of the message is used), a plain body (Mail::Message::Body), "undef" (which will be skipped), a scalar (which is split into lines), or an array of scalars (each providing one line). example: # all arguments are Mail::Message::Body's. my $sum = $body->concatenate($preamble, $body, $epilogue, "-- " , $sig); $obj->foreachLine(CODE) Create a new body by performing an action on each of its lines. If none of the lines change, the current body will be returned, otherwise a new body is created of the same type as the current. The CODE refers to a subroutine which is called, where $_ contains body's original line. DO NOT CHANGE $_!!! The result of the routine is taken as new line. When the routine returns "undef", the line will be skipped. example: my $content = $msg->decoded; my $reply = $content->foreachLine( sub { '> '.$_ } ); my $rev = $content->foreachLine( sub {reverse} ); sub filled() { length $_ > 1 ? $_ : undef } my $nonempty = $content->foreachLine( &filled ); my $wrong = $content->foreachLine( sub {s/a/A/} ); # WRONG!!! my $right = $content->foreachLine( sub {(my $x=$_) =~ s/a/A/; $x} ); $obj->stripSignature(OPTIONS) Strip the signature from the body. The body must already be decoded otherwise the wrong lines may get stripped. Returned is the stripped version body, and in list context also the signature, encapsulated in its own body object. The signature separator is the first line of the returned signature body. The signature is added by the sender to tell about him- or herself. It is superfluous in some situations, for instance if you want to create a reply to the person's message you do not need to include that signature. If the body had no signature, the original body object is returned, and "undef" for the signature body. -Option --Default max_lines 10 pattern qr/^--s?$/ result_type <same as current> max_lines => INTEGER|undef The maximum number of lines which can be the length of a signature. Specify "undef" to remove the limit. pattern => REGEX|STRING|CODE Which pattern defines the line which indicates the separator between the message and the signature. In case of a STRING, this is matched to the beginning of the line, and REGEX is a full regular expression. In case of CODE, each line (from last to front) is passed to the specified subroutine as first argument. The subroutine must return TRUE when the separator is found. result_type => CLASS The type of body to be created for the stripped body (and maybe also to contain the stripped signature) example: my $start = $message->decoded; my $start = $body->decoded; my $stripped = $start->stripSignature; my ($stripped, $sign) = $start->stripSignature (max_lines => 5, pattern => '-*-*-'); SEE ALSO
This module is part of Mail-Box distribution version 2.105, built on May 07, 2012. Website: http://perl.overmeer.net/mailbox/ LICENSE
Copyrights 2001-2012 by [Mark Overmeer]. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2012-05-07 Mail::Message::Body::Construct(3pm)
All times are GMT -4. The time now is 03:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy