logo
down
shadow

passing variables to another KSH script


passing variables to another KSH script

By : user2948874
Date : November 15 2020, 06:54 AM
hop of those help? lets say I have one KSH script that creates a variable....in that KSH script I call another KSH script file and want to pass a variable from the current script to the one that it calls...how do I do that? , See following example:
code :
[STEP 101] # cat foo.ksh
#!/usr/bin/ksh

var='hello' ./bar.ksh
echo "[foo.ksh] var=$var"

export var='world'
./bar.ksh
echo "[foo.ksh] var=$var"
[STEP 102] # cat bar.ksh
#!/usr/bin/ksh

echo "[bar.ksh] var=$var"
[STEP 103] # ./foo.ksh
[bar.ksh] var=hello
[foo.ksh] var=
[bar.ksh] var=world
[foo.ksh] var=world
[STEP 104] #


Share : facebook icon twitter icon
(Javascript) Passing variables in Codepen from JS window into HTML <script></script> template

(Javascript) Passing variables in Codepen from JS window into HTML <script></script> template


By : Virginia Smith
Date : March 29 2020, 07:55 AM
With these it helps If I understood correctly, you can just declare your map as a global variable an access it from your script. I called here myMap.
Something like that:
code :
  var myMap = null;

  function initMap() {

    /* ... */

    myMap = new google.maps.Map(
      document.getElementById('map'),
      {
        zoom: 4,
        center: uluru
        }
    );
  }
 /* add marker */
     var marker = new google.maps.Marker({
       position: {
         lat: lat,
         lng: long
       },
       map: myMap
     });   

   /* center in marker */
   myMap.panTo(marker.getPosition());
Passing variables to bash script vs setting env variables for the script

Passing variables to bash script vs setting env variables for the script


By : Peter Peter
Date : March 29 2020, 07:55 AM
I wish this helpful for you Using positional parameters is okay when you have a small limited amount of parameters.
Once you have a complex script with several parameters named parameters is the preferred way.
Can I access VSTS Build Definition Secret Variables (password variables) into shell script file directly without passing

Can I access VSTS Build Definition Secret Variables (password variables) into shell script file directly without passing


By : Michael Arnoldy
Date : March 29 2020, 07:55 AM
will help you No, you need to pass VSTS build variables as arguments into shell script file.
For inline script, you can use VSTS build variables (no matter secret variables or non-secret variables) directly by using the format $(variableName). For File path script, you use the pass VSTS build variables as arguments, so that the variables can be recognized in the shell script file.
Passing multiple variables from a Bash Script to an Expect Script

Passing multiple variables from a Bash Script to an Expect Script


By : Grzegorz Byrka
Date : March 29 2020, 07:55 AM
Hope this helps expect is an extension of the Tcl language, which is a fully featured programming language: it can read files and parse comma separated fields. There's no need for an inefficient shell script to invoke your expect program multiple times
code :
#!/usr/bin/bash/expect -f
set timeout 3

set file hostPasswordDynuList.csv
set fh [open $file r]

while {[gets $fh line] != -1} {
    lassign [split $line ,] host password

    spawn ssh -o "StrictHostKeyChecking no" admin+t@$host
    expect {
        "password: " { send $password"\r" }
        "Connection refused" {
            catch {exp_close}
            exp_wait
            continue 
        }
        eof {
            exp_wait
            continue 
        }
    }
    expect ".*" 
    send ":do { file remove push.auto.log } on-error={ \[\] }\r"
    expect ".*"
    exp_close
    exp_wait
}

close $fh
passing variables from a script in the head to a script in the body

passing variables from a script in the head to a script in the body


By : Cassio Kawakita
Date : March 29 2020, 07:55 AM
hop of those help? Yes, it is possible. Just make the function in the head global, and call it from the body script. Or call it in the head script and assign the result to a global variable that you access below.
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org