Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Passing variables between scripts... Post 302136679 by azbest on Wednesday 19th of September 2007 05:48:26 AM
Old 09-19-2007
Quote:
Originally Posted by Jazmania
Hey all,

I'm wondering how you pass variable's that are defined in one script to another script that's been called by that first script.....

Best regards,
Jaz
script1.sh
Code:
#!/usr/lcoal/bin/bash
VAR="something"
echo "script1 ${VAR}"
script2.sh ${VAR}

script2.sh
Code:
#!/usr/lcoal/bin/bash
echo "script2 ${VAR}"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

passing variables

Hi, Is there any way to pass variable to a sed script.For awk we have -v option.like that do we have any way to pass variable to a sed script from a awk script or from normal script? Thanx, sounder (1 Reply)
Discussion started by: sounder123
1 Replies

2. Shell Programming and Scripting

Passing Vars between scripts

Im running a script that runs scripts within it self and i need to pass vars made in the original script to scripts run within it and the only way i can think to do it is right the string to a file and read the file in the script (4 Replies)
Discussion started by: rcunn87
4 Replies

3. Shell Programming and Scripting

Passing and using arguments in Scripts.

I am new to scripting in AIX / UNIX. I have a script that runs 4 other scripts and I want to be able to pass in a agrument that I can check before I run the next script to see if the previous script finished with no errors. Can someone send me an example of this as I'm sure it's pretty easy to... (1 Reply)
Discussion started by: David.Vilmain
1 Replies

4. Shell Programming and Scripting

Passing variables between scripts

Hi all. I need to pass a value from a script that runs in a sub-shell, back into the calling shell like below (or into script 2 directly): outer_script export param=value1 script1 $param (in script1: export param=value2) script2 $param ($param is now value1, not value2... (4 Replies)
Discussion started by: bbergstrom74
4 Replies

5. Shell Programming and Scripting

Perl parameter passing between scripts

Hi All, I have two perl scripts say A.pl and B.pl. A.pl interacts with Database and pulllls around 20 column-variables, which needs to be used in B.pl . A.pl calls B.pl, I figured out that there exist a limit on number of arguments being passed as command line argument. A.pl writing to a... (3 Replies)
Discussion started by: coolbhai
3 Replies

6. Shell Programming and Scripting

Passing Arguments in Shell Scripts

Hello everybody! First time posting here:) Right, I am trying to pass arguments in my shell scripts using $1, $2 and $3 etc using if else statement........ This is my shell script which is based on serching the google website #!/bin/sh wget -t1 -E -e robots=off - -awGet.log -T 200 -H... (47 Replies)
Discussion started by: kev_1234
47 Replies

7. Shell Programming and Scripting

Passing variables between sub-scripts

I have written a program for some data analysis. It is gettin long. I would like to restructure it so that i can have a master file which controls multiple subscripts in order to make it easier to understand. I need to be able to define variables in the master script which are used by all three... (2 Replies)
Discussion started by: carlr
2 Replies

8. Shell Programming and Scripting

General question about passing variables among shell scripts

So this is something I've been wondering how to do for a while. Suppose I have two shell scripts a.sh and b.sh script a does some function and outputs to a varable $x . I would then like to take $x into the second function, b.sh, and do a function on it and create some output. So how do you pass... (3 Replies)
Discussion started by: viored
3 Replies

9. Shell Programming and Scripting

Passing awk variables to bash variables

Trying to do so echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies

10. Shell Programming and Scripting

Passing parameters with spaces between scripts

I have 2 scripts. test.sh, which calls submit2.sh. One of the parameters contains space and is quoted. ((((./submit2.sh Group_1_2_AMS_DAILY_CORE_GRP03 AMS AMS_D 'DAILY REPORT PROCEDURES'; echo $?>&3) | tee 1.log >&4)3>&1) | (read xs; exit $xs)) 4>&1 echo parm 1 = $1 echo parm 2 = $2... (1 Reply)
Discussion started by: andyclam
1 Replies
GIT-VAR(1)							    Git Manual								GIT-VAR(1)

NAME
       git-var - Show a Git logical variable

SYNOPSIS
       git var ( -l | <variable> )

DESCRIPTION
       Prints a Git logical variable.

OPTIONS
       -l
	   Cause the logical variables to be listed. In addition, all the variables of the Git configuration file .git/config are listed as well.
	   (However, the configuration variables listing functionality is deprecated in favor of git config -l.)

EXAMPLE
	   $ git var GIT_AUTHOR_IDENT
	   Eric W. Biederman <ebiederm@lnxi.com> 1121223278 -0600

VARIABLES
       GIT_AUTHOR_IDENT
	   The author of a piece of code.

       GIT_COMMITTER_IDENT
	   The person who put a piece of code into Git.

       GIT_EDITOR
	   Text editor for use by Git commands. The value is meant to be interpreted by the shell when it is used. Examples: ~/bin/vi,
	   $SOME_ENVIRONMENT_VARIABLE, "C:Program FilesVimgvim.exe" --nofork. The order of preference is the $GIT_EDITOR environment variable,
	   then core.editor configuration, then $VISUAL, then $EDITOR, and then the default chosen at compile time, which is usually vi.

       GIT_PAGER
	   Text viewer for use by Git commands (e.g., less). The value is meant to be interpreted by the shell. The order of preference is the
	   $GIT_PAGER environment variable, then core.pager configuration, then $PAGER, and then the default chosen at compile time (usually
	   less).

SEE ALSO
       git-commit-tree(1) git-tag(1) git-config(1)

GIT
       Part of the git(1) suite

Git 2.17.1							    10/05/2018								GIT-VAR(1)
All times are GMT -4. The time now is 05:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy