Questions tagged [dot-source]

The dot (.) or source command is used to evaluate shell scripts in the current execution context

35 questions
0
votes
0 answers

How can I source a script using a zsh function, without spawning a subshell, to set environment vars?

I'm trying to run a zsh/bash script that writes several values to environment variables, I want these variables available to the parent shell as they are required for several tools we use. If I manually run the script using '. myscript myparamater'…
0
votes
0 answers

Dot-sourced script not referencing current directory on 2nd run

I have a script, below, which I have in a Scripts folder. It references a set of command prompt applications $cmd1.exe, etc.. Using either Powershell or the Integrated Powershell terminal in VS Code, I follow these steps to use it: Dot source the…
Eeshwar
  • 53
  • 6
0
votes
2 answers

Difference between source, zsh, "." and directly shell script calling

I have very simple script(for_loop4.sh) as shown below. # !/bin/zsh # for (( i = 0; i < 3; i++ )) do echo $i; done I'm using zsh 5.0.7 for my shell. When running this script using source, zsh and . command, it works as expected. But, when…
John
  • 41
  • 6
0
votes
1 answer

starting a job with dot source

quick story: for the sake of experimentation with powershell I'm trying to learn how to effectively multithread a script. now i know how to start jobs and pass variables to my second script, however i have decided to try and figure out how to turn…
LuckyFalkor84
  • 547
  • 1
  • 5
  • 14
-3
votes
3 answers

how does " . ./filename " command work

I was following a tutorial on openvpn and it needed to execute a command . ./vars. It displays a message. On reading the file I found that it executes a echo command in file and disregards everything else in file. On adding other echo statement, it…
Anmol
  • 123
  • 4
1 2
3