How to use password retrieved from `pass` in a shell scriptTrying to cp a path with spaces, fails when...
What happens when a metallic dragon and a chromatic dragon mate?
Creating a loop after a break using Markov Chain in Tikz
Need help identifying/translating a plaque in Tangier, Morocco
Does the average primeness of natural numbers tend to zero?
Doomsday-clock for my fantasy planet
Why do UK politicians seemingly ignore opinion polls on Brexit?
Pristine Bit Checking
Can I legally use front facing blue light in the UK?
Can the Produce Flame cantrip be used to grapple, or as an unarmed strike, in the right circumstances?
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
Unbreakable Formation vs. Cry of the Carnarium
COUNT(*) or MAX(id) - which is faster?
Ideas for 3rd eye abilities
Where else does the Shulchan Aruch quote an authority by name?
Information to fellow intern about hiring?
Why is my log file so massive? 22gb. I am running log backups
Re-submission of rejected manuscript without informing co-authors
Is this food a bread or a loaf?
Can I find out the caloric content of bread by dehydrating it?
Is Social Media Science Fiction?
Is this relativistic mass?
Prime joint compound before latex paint?
Why airport relocation isn't done gradually?
Extreme, but not acceptable situation and I can't start the work tomorrow morning
How to use password retrieved from `pass` in a shell script
Trying to cp a path with spaces, fails when scripted but echoing and pasting succeeds?SSH Tunneling Through a Firewall to a ClusterHow to use password in shell scriptingBash variable containing JSON splits on single quotesHow to pass array to bash shell script?variable not being read correctlyRetrieved value from associative array is wrong?bash subshell export variablePass A File Through Shell ScriptBash Script - How can I concatenate several strings containing special characters?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I stored a password in using the pass
and based I am trying to automate a VPN Connection process using Cisco Anyconnect. The VPN works, I confirmed that. The script I am trying to use is:
pass=$(pass branch/key)
vpn -s connect vpn.server.host << "EOF"
0
username
"$pass"
y
exit
EOF
Suppose I save that as .connectvpn
and say source .connectvpn
then it should start a VPN tunnel and get a connection going.
If in the file I get rid of the variable I am trying to use (pass
), and put the actual password on the fifth line I know it works. The trouble I am having is with the bash variable approach.
bash terminal
New contributor
add a comment |
I stored a password in using the pass
and based I am trying to automate a VPN Connection process using Cisco Anyconnect. The VPN works, I confirmed that. The script I am trying to use is:
pass=$(pass branch/key)
vpn -s connect vpn.server.host << "EOF"
0
username
"$pass"
y
exit
EOF
Suppose I save that as .connectvpn
and say source .connectvpn
then it should start a VPN tunnel and get a connection going.
If in the file I get rid of the variable I am trying to use (pass
), and put the actual password on the fifth line I know it works. The trouble I am having is with the bash variable approach.
bash terminal
New contributor
add a comment |
I stored a password in using the pass
and based I am trying to automate a VPN Connection process using Cisco Anyconnect. The VPN works, I confirmed that. The script I am trying to use is:
pass=$(pass branch/key)
vpn -s connect vpn.server.host << "EOF"
0
username
"$pass"
y
exit
EOF
Suppose I save that as .connectvpn
and say source .connectvpn
then it should start a VPN tunnel and get a connection going.
If in the file I get rid of the variable I am trying to use (pass
), and put the actual password on the fifth line I know it works. The trouble I am having is with the bash variable approach.
bash terminal
New contributor
I stored a password in using the pass
and based I am trying to automate a VPN Connection process using Cisco Anyconnect. The VPN works, I confirmed that. The script I am trying to use is:
pass=$(pass branch/key)
vpn -s connect vpn.server.host << "EOF"
0
username
"$pass"
y
exit
EOF
Suppose I save that as .connectvpn
and say source .connectvpn
then it should start a VPN tunnel and get a connection going.
If in the file I get rid of the variable I am trying to use (pass
), and put the actual password on the fifth line I know it works. The trouble I am having is with the bash variable approach.
bash terminal
bash terminal
New contributor
New contributor
New contributor
asked yesterday
ITAITA
1032
1032
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Your problem is that you have quoted the delimiter, "EOF"
. When the delimiter of a here-document is quoted, no parameter expansion is performed on the body, so your password gets its literal value, "$pass"
. Try using EOF
without quotes as a delimiter.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
ITA 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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511125%2fhow-to-use-password-retrieved-from-pass-in-a-shell-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your problem is that you have quoted the delimiter, "EOF"
. When the delimiter of a here-document is quoted, no parameter expansion is performed on the body, so your password gets its literal value, "$pass"
. Try using EOF
without quotes as a delimiter.
add a comment |
Your problem is that you have quoted the delimiter, "EOF"
. When the delimiter of a here-document is quoted, no parameter expansion is performed on the body, so your password gets its literal value, "$pass"
. Try using EOF
without quotes as a delimiter.
add a comment |
Your problem is that you have quoted the delimiter, "EOF"
. When the delimiter of a here-document is quoted, no parameter expansion is performed on the body, so your password gets its literal value, "$pass"
. Try using EOF
without quotes as a delimiter.
Your problem is that you have quoted the delimiter, "EOF"
. When the delimiter of a here-document is quoted, no parameter expansion is performed on the body, so your password gets its literal value, "$pass"
. Try using EOF
without quotes as a delimiter.
answered yesterday
Dmitry GrigoryevDmitry Grigoryev
5,1241045
5,1241045
add a comment |
add a comment |
ITA is a new contributor. Be nice, and check out our Code of Conduct.
ITA is a new contributor. Be nice, and check out our Code of Conduct.
ITA is a new contributor. Be nice, and check out our Code of Conduct.
ITA is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511125%2fhow-to-use-password-retrieved-from-pass-in-a-shell-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown