Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Overwrite a Source Script Variable Value Post 302820945 by Ariean on Thursday 13th of June 2013 05:11:25 PM
Old 06-13-2013
Overwrite a Source Script Variable Value

Hello All,
How do i overwrite a sourced script variable value.

Sourced Script:
Code:
GEN_PARAM_LIST4=""$LOG_DIR"/dwh_GenerateXMLFile.lst"
GEN_PARAM_LIST4_v2=""$LOG_DIR"/dwh_GenerateXMLFile.v2.lst"

I am using below statement for replacing.
Script2:
Code:
[ ! -z ${UNINUM} ] && "${GEN_PARAM_LIST4}"="${GEN_PARAM_LIST4_v2}"

Error:
Code:
/home/infrmtca/bin/dwh_GenerateXMLFile.sh: line 204: /home/infrmtca/bin/log/dwh_GenerateXMLFile.lst=/home/infrmtca/bin/log/dwh_GenerateXMLFile.v2.lst: No such file or directory

---------- Post updated at 05:11 PM ---------- Previous update was at 05:06 PM ----------

I think i got it but not sure if this is right approach.

Code:
[ ! -z ${UNINUM} ] && GEN_PARAM_LIST4="${GEN_PARAM_LIST4_v2}"

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

a script to clone a dir tree, & overwrite the dir struct elsewhere?

hi all, i'm looking for a bash or tcsh script that will clone an empty dir tree 'over' another tree ... specifically, i'd like to: (1) specify a src directory (2) list the directory tree/hiearchy beneath that src dir, w/o files -- just the dirs (3) clone that same, empty dir hierarchy to... (2 Replies)
Discussion started by: OpenMacNews
2 Replies

2. Shell Programming and Scripting

Overwrite a running shell script

Hello all, This might be a dumb question...but i am running into this situation. I have a shell script that is currently in running state. It has big sql's in it and will run for few days. What happens if I change the shell now? Eg: a.shl is running and i want to mv b.shl a.shl I... (5 Replies)
Discussion started by: gsjdrr
5 Replies

3. Shell Programming and Scripting

how to source csh script in tcl script

i have atcl script and i want to source a csh script to reflect changes done by script ........ Please help....... (0 Replies)
Discussion started by: paragarora47
0 Replies

4. Shell Programming and Scripting

Source environment variable in script

Hi, I construct a bash script to finish some tasks. One of the task is to set up some environment variables. There is already one script file to complete the environment variables setting work. I am not able to know the detail of how to set these variables. So, I may just need to call this... (4 Replies)
Discussion started by: gofortime
4 Replies

5. Shell Programming and Scripting

Need to overwrite shell script using vi editor

I have an existing shell script that I am trying to modify. I have about 10 lines of info I want to overwrite using text someone emailed to me. I guess what I am trying to do basically is like a copy/paste, but it's not working for me. I am using Cygwin and vi editor. I open the script and... (4 Replies)
Discussion started by: kimberlyg2007
4 Replies

6. Shell Programming and Scripting

Shell script to overwrite a file

Hi Guys, My requirement as follows, i want to write a shell script to display the files of a folder, i export it to a file to mail the file. The problem is the exported file is getting appended every time I run the script. I just want the file to be over written. can anyone suggest?? ... (4 Replies)
Discussion started by: Karthick N
4 Replies

7. Shell Programming and Scripting

Script to overwrite & before that keep copy a file on many servers

I have ssh password less auth enable & script does the job well as well #/bin/bash for i in `cat ip` do scp /etc/resolv.conf root@$ip done But I need to take backup of the file i will overwrite .. is there any simple way ? Kindly respond (5 Replies)
Discussion started by: heman96
5 Replies

8. Shell Programming and Scripting

Source functions from variable

I have a functions file containing functions: file.functions: myTest () { echo "MYPWD=$(echo $(pwd))" echo "MYLOGNAME=${LOGNAME}" } myCar () { echo "MYDATE=$(date)" echo "MYUPTIME=$(uptime)" } i know i can source this file in another script using something similar to this: source... (8 Replies)
Discussion started by: SkySmart
8 Replies

9. Shell Programming and Scripting

Source functions from variable

so i found a way to do this. #!/bin/bash MYF=$(/home/jason/myfunctions) source <(printf '%s\n' "${MYF}") echo "${var1}" /home/jason/myfunctions is a script that outputs information..i.e. functions...etc that needs to be sourced. I have no control over /home/jason/myfunctions. i can... (3 Replies)
Discussion started by: SkySmart
3 Replies
Test::Script(3) 					User Contributed Perl Documentation					   Test::Script(3)

NAME
Test::Script - Basic cross-platform tests for scripts DESCRIPTION
The intent of this module is to provide a series of basic tests for 80% of the testing you will need to do for scripts in the script (or bin as is also commonly used) paths of your Perl distribution. Further, it aims to provide this functionality with perfect platform-compatibility, and in a way that is as unobtrusive as possible. That is, if the program works on a platform, then Test::Script should always work on that platform as well. Anything less than 100% is considered unacceptable. In doing so, it is hoped that Test::Script can become a module that you can safely make a dependency of all your modules, without risking that your module won't on some platform because of the dependency. Where a clash exists between wanting more functionality and maintaining platform safety, this module will err on the side of platform safety. FUNCTIONS
script_compiles script_compiles( 'script/foo.pl', 'Main script compiles' ); The "script_compiles" test calls the script with "perl -c script.pl", and checks that it returns without error. The path it should be passed is a relative unix-format script name. This will be localised when running "perl -c" and if the test fails the local name used will be shown in the diagnostic output. Note also that the test will be run with the same perl interpreter that is running the test script (and not with the default system perl). This will also be shown in the diagnostic output on failure. script_runs script_runs( 'script/foo.pl', 'Main script runs' ); The "script_runs" test executes the script with "perl script.pl" and checks that it returns success. The path it should be passed is a relative unix-format script name. This will be localised when running "perl -c" and if the test fails the local name used will be shown in the diagnostic output. The test will be run with the same perl interpreter that is running the test script (and not with the default system perl). This will also be shown in the diagnostic output on failure. SUPPORT
All bugs should be filed via the bug tracker at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Script <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Script> For other issues, or commercial enhancement and support, contact the author. AUTHOR
Adam Kennedy <adamk@cpan.org> SEE ALSO
prove, <http://ali.as/> COPYRIGHT
Copyright 2006 - 2009 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.16.2 2009-11-23 Test::Script(3)
All times are GMT -4. The time now is 06:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy