Need optimal code for .zshrc to source file after curl
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am having issues with my .zshrc file setting up my zplugin for a first-time run. Its purpose is to fetch the installer from zplug github, run the shell install, then source it.
This is my .zshrc file:
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
fi
source ~/.zplug/init.zsh
And this is the output from starting up my terminal:
â Checking if your zsh version is newer than 4.1.9 [SUCCEEDED]
â Installing zplug to /home/thomas/.zplug [SUCCEEDED]
All processes are successfully completed ðÂÂÂ
For more information, see http://zplug.sh ðº
Enjoy zplug!
/home/dwarfoz/.zshrc:source:8: no such file or directory: /home/dwarfoz/.zplug/init.zsh
Install succeeds but sourcing fails :(
So I think this might be some sort of race condition. I put a sleep timer for two seconds after curl.
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
sleep 2
fi
source ~/.zplug/init.zsh
And indeed it works. (terminal output omitted here)
So I'm wondering if there's a way to source the file as soon curl completes -- without waiting some arbitrary amount of time like 2 seconds.
zsh
New contributor
add a comment |Â
up vote
0
down vote
favorite
I am having issues with my .zshrc file setting up my zplugin for a first-time run. Its purpose is to fetch the installer from zplug github, run the shell install, then source it.
This is my .zshrc file:
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
fi
source ~/.zplug/init.zsh
And this is the output from starting up my terminal:
â Checking if your zsh version is newer than 4.1.9 [SUCCEEDED]
â Installing zplug to /home/thomas/.zplug [SUCCEEDED]
All processes are successfully completed ðÂÂÂ
For more information, see http://zplug.sh ðº
Enjoy zplug!
/home/dwarfoz/.zshrc:source:8: no such file or directory: /home/dwarfoz/.zplug/init.zsh
Install succeeds but sourcing fails :(
So I think this might be some sort of race condition. I put a sleep timer for two seconds after curl.
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
sleep 2
fi
source ~/.zplug/init.zsh
And indeed it works. (terminal output omitted here)
So I'm wondering if there's a way to source the file as soon curl completes -- without waiting some arbitrary amount of time like 2 seconds.
zsh
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am having issues with my .zshrc file setting up my zplugin for a first-time run. Its purpose is to fetch the installer from zplug github, run the shell install, then source it.
This is my .zshrc file:
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
fi
source ~/.zplug/init.zsh
And this is the output from starting up my terminal:
â Checking if your zsh version is newer than 4.1.9 [SUCCEEDED]
â Installing zplug to /home/thomas/.zplug [SUCCEEDED]
All processes are successfully completed ðÂÂÂ
For more information, see http://zplug.sh ðº
Enjoy zplug!
/home/dwarfoz/.zshrc:source:8: no such file or directory: /home/dwarfoz/.zplug/init.zsh
Install succeeds but sourcing fails :(
So I think this might be some sort of race condition. I put a sleep timer for two seconds after curl.
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
sleep 2
fi
source ~/.zplug/init.zsh
And indeed it works. (terminal output omitted here)
So I'm wondering if there's a way to source the file as soon curl completes -- without waiting some arbitrary amount of time like 2 seconds.
zsh
New contributor
I am having issues with my .zshrc file setting up my zplugin for a first-time run. Its purpose is to fetch the installer from zplug github, run the shell install, then source it.
This is my .zshrc file:
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
fi
source ~/.zplug/init.zsh
And this is the output from starting up my terminal:
â Checking if your zsh version is newer than 4.1.9 [SUCCEEDED]
â Installing zplug to /home/thomas/.zplug [SUCCEEDED]
All processes are successfully completed ðÂÂÂ
For more information, see http://zplug.sh ðº
Enjoy zplug!
/home/dwarfoz/.zshrc:source:8: no such file or directory: /home/dwarfoz/.zplug/init.zsh
Install succeeds but sourcing fails :(
So I think this might be some sort of race condition. I put a sleep timer for two seconds after curl.
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
sleep 2
fi
source ~/.zplug/init.zsh
And indeed it works. (terminal output omitted here)
So I'm wondering if there's a way to source the file as soon curl completes -- without waiting some arbitrary amount of time like 2 seconds.
zsh
zsh
New contributor
New contributor
New contributor
asked 58 secs ago
dwarfoz
1
1
New contributor
New contributor
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
dwarfoz is a new contributor. Be nice, and check out our Code of Conduct.
dwarfoz is a new contributor. Be nice, and check out our Code of Conduct.
dwarfoz is a new contributor. Be nice, and check out our Code of Conduct.
dwarfoz is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479808%2fneed-optimal-code-for-zshrc-to-source-file-after-curl%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password