Reading in variables from a file to use in a bash script strips out
So I am loading in a properties file to define some variables. In this example imagine it is a string mark!slashending
called INPUT
.
INPUT
is declared by loading in the properties file using:
. ./properties
where
INPUT=mark!slashending
I need the final output to be a script run through SED of the form s!@output@!$INPUT!g
such that when executed, @output@
is replaced in another file with the input from the properties file defined by the user (the variable, in this case, is INPUT
). We are using !
as the delimiter in SED so this character will need to be escaped (as well as any ) before added to the SED template file.
If I try
echo SAFE_INPUT=$(printf '%sn' 'mark!slashending' | sed 's:[!]:\&:g')
I get the expected output
mark!slash\ending\
If, however, I try
SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
I get
mark!slashending
I am assuming it is something to do with my declaration of string vs a variable but I am at a loss as to the difference and how to solve the issue right now.
Edit:
On further testing INPUT
as read using
. ./properties
is printed as
mark!slashending
So this is not an issue with SED but with reading in the property file.
shell-script sed regular-expression
add a comment |
So I am loading in a properties file to define some variables. In this example imagine it is a string mark!slashending
called INPUT
.
INPUT
is declared by loading in the properties file using:
. ./properties
where
INPUT=mark!slashending
I need the final output to be a script run through SED of the form s!@output@!$INPUT!g
such that when executed, @output@
is replaced in another file with the input from the properties file defined by the user (the variable, in this case, is INPUT
). We are using !
as the delimiter in SED so this character will need to be escaped (as well as any ) before added to the SED template file.
If I try
echo SAFE_INPUT=$(printf '%sn' 'mark!slashending' | sed 's:[!]:\&:g')
I get the expected output
mark!slash\ending\
If, however, I try
SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
I get
mark!slashending
I am assuming it is something to do with my declaration of string vs a variable but I am at a loss as to the difference and how to solve the issue right now.
Edit:
On further testing INPUT
as read using
. ./properties
is printed as
mark!slashending
So this is not an issue with SED but with reading in the property file.
shell-script sed regular-expression
1
how you are declaringINPUT
?
– msp9011
Feb 1 at 11:02
We really can't help if you don't show us how you assign a value toINPUT
. The command you show works perfectly well if you just useINPUT='mark!slashending'
.
– terdon♦
Feb 1 at 11:31
Edited to show how INPUT is loaded in.
– Gathris
Feb 1 at 11:40
add a comment |
So I am loading in a properties file to define some variables. In this example imagine it is a string mark!slashending
called INPUT
.
INPUT
is declared by loading in the properties file using:
. ./properties
where
INPUT=mark!slashending
I need the final output to be a script run through SED of the form s!@output@!$INPUT!g
such that when executed, @output@
is replaced in another file with the input from the properties file defined by the user (the variable, in this case, is INPUT
). We are using !
as the delimiter in SED so this character will need to be escaped (as well as any ) before added to the SED template file.
If I try
echo SAFE_INPUT=$(printf '%sn' 'mark!slashending' | sed 's:[!]:\&:g')
I get the expected output
mark!slash\ending\
If, however, I try
SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
I get
mark!slashending
I am assuming it is something to do with my declaration of string vs a variable but I am at a loss as to the difference and how to solve the issue right now.
Edit:
On further testing INPUT
as read using
. ./properties
is printed as
mark!slashending
So this is not an issue with SED but with reading in the property file.
shell-script sed regular-expression
So I am loading in a properties file to define some variables. In this example imagine it is a string mark!slashending
called INPUT
.
INPUT
is declared by loading in the properties file using:
. ./properties
where
INPUT=mark!slashending
I need the final output to be a script run through SED of the form s!@output@!$INPUT!g
such that when executed, @output@
is replaced in another file with the input from the properties file defined by the user (the variable, in this case, is INPUT
). We are using !
as the delimiter in SED so this character will need to be escaped (as well as any ) before added to the SED template file.
If I try
echo SAFE_INPUT=$(printf '%sn' 'mark!slashending' | sed 's:[!]:\&:g')
I get the expected output
mark!slash\ending\
If, however, I try
SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
I get
mark!slashending
I am assuming it is something to do with my declaration of string vs a variable but I am at a loss as to the difference and how to solve the issue right now.
Edit:
On further testing INPUT
as read using
. ./properties
is printed as
mark!slashending
So this is not an issue with SED but with reading in the property file.
shell-script sed regular-expression
shell-script sed regular-expression
edited Feb 1 at 16:26
Rui F Ribeiro
40.1k1479136
40.1k1479136
asked Feb 1 at 10:45
GathrisGathris
84
84
1
how you are declaringINPUT
?
– msp9011
Feb 1 at 11:02
We really can't help if you don't show us how you assign a value toINPUT
. The command you show works perfectly well if you just useINPUT='mark!slashending'
.
– terdon♦
Feb 1 at 11:31
Edited to show how INPUT is loaded in.
– Gathris
Feb 1 at 11:40
add a comment |
1
how you are declaringINPUT
?
– msp9011
Feb 1 at 11:02
We really can't help if you don't show us how you assign a value toINPUT
. The command you show works perfectly well if you just useINPUT='mark!slashending'
.
– terdon♦
Feb 1 at 11:31
Edited to show how INPUT is loaded in.
– Gathris
Feb 1 at 11:40
1
1
how you are declaring
INPUT
?– msp9011
Feb 1 at 11:02
how you are declaring
INPUT
?– msp9011
Feb 1 at 11:02
We really can't help if you don't show us how you assign a value to
INPUT
. The command you show works perfectly well if you just use INPUT='mark!slashending'
.– terdon♦
Feb 1 at 11:31
We really can't help if you don't show us how you assign a value to
INPUT
. The command you show works perfectly well if you just use INPUT='mark!slashending'
.– terdon♦
Feb 1 at 11:31
Edited to show how INPUT is loaded in.
– Gathris
Feb 1 at 11:40
Edited to show how INPUT is loaded in.
– Gathris
Feb 1 at 11:40
add a comment |
2 Answers
2
active
oldest
votes
The problem is when you set variable INPUT
in file properties
like shown in the question
INPUT=mark!slashending
and source it as a shell script.
The first e
is replaced by the shell with e
and the at the end of the line will either be removed if there is some whitespace following it, otherwise it denotes that the line is continied in the next line. So the value of
INPUT
will already be modified.
You either have to define your input with quotes
INPUT='mark!slashending'
like in Cornholio's answer or you have to parse your properties
file in a different way.
With the following command you will get variable INPUT (and others if there are more lines in properties
) set to the correct value.
eval $(sed -e 's:[!]:\&:g' properties)
This will let the shell eval
uate the output of the sed
command which replaces and
!
and in the contents of properties
. The result will be variables with the original names INPUT
etc. This will work if your properties
file contains one or more variable assignments. It may give strange result with other shell script code.
Note: If your input file contains other special characters, the peprocessing would be more difficult. So using eval
this way without additional checking may be fragile or dangerous.
With your example the variable INPUT
will have the intended value mark!slashending
After this you can do
SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
if you need variable SAVE_INPUT
to contain mark!slash\ending\
.
A better way would be to read the input line by line with while read -r line
and check and process the line to separate variable name and value.
Preprocessing the script to run it througheval
seems a bit fickly. At least you'd need to add backslashes in front of a bunch of other characters too, not just!
and` (
$` would be an obvious one). Better to just quote the string in the original file.
– ilkkachu
Feb 1 at 14:40
im not sure quoting the string works, thats what im trying now, with apache configs. things would actually be really messed up if you have to escapce every wierd character. your readfile would then look like a big regex escaped mess. So it almost seems counterintuitive that it would be possible by readfile, however there must be a way. I need the readfile, when interepted by sed, to become the value of the variable, as opposed to literal$var
. e.g. it needs to eval, but i dont like restorting to aneval()
solution either.Is that really our only option here?
– Brian Thomas
Feb 9 at 5:17
add a comment |
If I do the following, with the value of INPUT
quoted, it works:
> INPUT='mark!slashending'
> SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
> echo $SAFE_INPUT
mark!slash\ending\
Note, it's an exact copy of your script, with INPUT=
added by me.
Hey, this is an answer that actually works, no need to even think about posting it as a comment instead of a proper answer!
– ilkkachu
Feb 1 at 14:34
This may work, but how would you then, use vars in your input string, which what im trying to do. e.g. my input string is a file path, thats evaluated by sed read, as opposed to a var of data. once sed read reads the text, i want the var evaluqated when read parses the read. Is this possible?
– Brian Thomas
Feb 9 at 5:23
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
});
}
});
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%2f498109%2freading-in-variables-from-a-file-to-use-in-a-bash-script-strips-out%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem is when you set variable INPUT
in file properties
like shown in the question
INPUT=mark!slashending
and source it as a shell script.
The first e
is replaced by the shell with e
and the at the end of the line will either be removed if there is some whitespace following it, otherwise it denotes that the line is continied in the next line. So the value of
INPUT
will already be modified.
You either have to define your input with quotes
INPUT='mark!slashending'
like in Cornholio's answer or you have to parse your properties
file in a different way.
With the following command you will get variable INPUT (and others if there are more lines in properties
) set to the correct value.
eval $(sed -e 's:[!]:\&:g' properties)
This will let the shell eval
uate the output of the sed
command which replaces and
!
and in the contents of properties
. The result will be variables with the original names INPUT
etc. This will work if your properties
file contains one or more variable assignments. It may give strange result with other shell script code.
Note: If your input file contains other special characters, the peprocessing would be more difficult. So using eval
this way without additional checking may be fragile or dangerous.
With your example the variable INPUT
will have the intended value mark!slashending
After this you can do
SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
if you need variable SAVE_INPUT
to contain mark!slash\ending\
.
A better way would be to read the input line by line with while read -r line
and check and process the line to separate variable name and value.
Preprocessing the script to run it througheval
seems a bit fickly. At least you'd need to add backslashes in front of a bunch of other characters too, not just!
and` (
$` would be an obvious one). Better to just quote the string in the original file.
– ilkkachu
Feb 1 at 14:40
im not sure quoting the string works, thats what im trying now, with apache configs. things would actually be really messed up if you have to escapce every wierd character. your readfile would then look like a big regex escaped mess. So it almost seems counterintuitive that it would be possible by readfile, however there must be a way. I need the readfile, when interepted by sed, to become the value of the variable, as opposed to literal$var
. e.g. it needs to eval, but i dont like restorting to aneval()
solution either.Is that really our only option here?
– Brian Thomas
Feb 9 at 5:17
add a comment |
The problem is when you set variable INPUT
in file properties
like shown in the question
INPUT=mark!slashending
and source it as a shell script.
The first e
is replaced by the shell with e
and the at the end of the line will either be removed if there is some whitespace following it, otherwise it denotes that the line is continied in the next line. So the value of
INPUT
will already be modified.
You either have to define your input with quotes
INPUT='mark!slashending'
like in Cornholio's answer or you have to parse your properties
file in a different way.
With the following command you will get variable INPUT (and others if there are more lines in properties
) set to the correct value.
eval $(sed -e 's:[!]:\&:g' properties)
This will let the shell eval
uate the output of the sed
command which replaces and
!
and in the contents of properties
. The result will be variables with the original names INPUT
etc. This will work if your properties
file contains one or more variable assignments. It may give strange result with other shell script code.
Note: If your input file contains other special characters, the peprocessing would be more difficult. So using eval
this way without additional checking may be fragile or dangerous.
With your example the variable INPUT
will have the intended value mark!slashending
After this you can do
SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
if you need variable SAVE_INPUT
to contain mark!slash\ending\
.
A better way would be to read the input line by line with while read -r line
and check and process the line to separate variable name and value.
Preprocessing the script to run it througheval
seems a bit fickly. At least you'd need to add backslashes in front of a bunch of other characters too, not just!
and` (
$` would be an obvious one). Better to just quote the string in the original file.
– ilkkachu
Feb 1 at 14:40
im not sure quoting the string works, thats what im trying now, with apache configs. things would actually be really messed up if you have to escapce every wierd character. your readfile would then look like a big regex escaped mess. So it almost seems counterintuitive that it would be possible by readfile, however there must be a way. I need the readfile, when interepted by sed, to become the value of the variable, as opposed to literal$var
. e.g. it needs to eval, but i dont like restorting to aneval()
solution either.Is that really our only option here?
– Brian Thomas
Feb 9 at 5:17
add a comment |
The problem is when you set variable INPUT
in file properties
like shown in the question
INPUT=mark!slashending
and source it as a shell script.
The first e
is replaced by the shell with e
and the at the end of the line will either be removed if there is some whitespace following it, otherwise it denotes that the line is continied in the next line. So the value of
INPUT
will already be modified.
You either have to define your input with quotes
INPUT='mark!slashending'
like in Cornholio's answer or you have to parse your properties
file in a different way.
With the following command you will get variable INPUT (and others if there are more lines in properties
) set to the correct value.
eval $(sed -e 's:[!]:\&:g' properties)
This will let the shell eval
uate the output of the sed
command which replaces and
!
and in the contents of properties
. The result will be variables with the original names INPUT
etc. This will work if your properties
file contains one or more variable assignments. It may give strange result with other shell script code.
Note: If your input file contains other special characters, the peprocessing would be more difficult. So using eval
this way without additional checking may be fragile or dangerous.
With your example the variable INPUT
will have the intended value mark!slashending
After this you can do
SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
if you need variable SAVE_INPUT
to contain mark!slash\ending\
.
A better way would be to read the input line by line with while read -r line
and check and process the line to separate variable name and value.
The problem is when you set variable INPUT
in file properties
like shown in the question
INPUT=mark!slashending
and source it as a shell script.
The first e
is replaced by the shell with e
and the at the end of the line will either be removed if there is some whitespace following it, otherwise it denotes that the line is continied in the next line. So the value of
INPUT
will already be modified.
You either have to define your input with quotes
INPUT='mark!slashending'
like in Cornholio's answer or you have to parse your properties
file in a different way.
With the following command you will get variable INPUT (and others if there are more lines in properties
) set to the correct value.
eval $(sed -e 's:[!]:\&:g' properties)
This will let the shell eval
uate the output of the sed
command which replaces and
!
and in the contents of properties
. The result will be variables with the original names INPUT
etc. This will work if your properties
file contains one or more variable assignments. It may give strange result with other shell script code.
Note: If your input file contains other special characters, the peprocessing would be more difficult. So using eval
this way without additional checking may be fragile or dangerous.
With your example the variable INPUT
will have the intended value mark!slashending
After this you can do
SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
if you need variable SAVE_INPUT
to contain mark!slash\ending\
.
A better way would be to read the input line by line with while read -r line
and check and process the line to separate variable name and value.
edited Feb 1 at 15:14
answered Feb 1 at 12:19
BodoBodo
1,03219
1,03219
Preprocessing the script to run it througheval
seems a bit fickly. At least you'd need to add backslashes in front of a bunch of other characters too, not just!
and` (
$` would be an obvious one). Better to just quote the string in the original file.
– ilkkachu
Feb 1 at 14:40
im not sure quoting the string works, thats what im trying now, with apache configs. things would actually be really messed up if you have to escapce every wierd character. your readfile would then look like a big regex escaped mess. So it almost seems counterintuitive that it would be possible by readfile, however there must be a way. I need the readfile, when interepted by sed, to become the value of the variable, as opposed to literal$var
. e.g. it needs to eval, but i dont like restorting to aneval()
solution either.Is that really our only option here?
– Brian Thomas
Feb 9 at 5:17
add a comment |
Preprocessing the script to run it througheval
seems a bit fickly. At least you'd need to add backslashes in front of a bunch of other characters too, not just!
and` (
$` would be an obvious one). Better to just quote the string in the original file.
– ilkkachu
Feb 1 at 14:40
im not sure quoting the string works, thats what im trying now, with apache configs. things would actually be really messed up if you have to escapce every wierd character. your readfile would then look like a big regex escaped mess. So it almost seems counterintuitive that it would be possible by readfile, however there must be a way. I need the readfile, when interepted by sed, to become the value of the variable, as opposed to literal$var
. e.g. it needs to eval, but i dont like restorting to aneval()
solution either.Is that really our only option here?
– Brian Thomas
Feb 9 at 5:17
Preprocessing the script to run it through
eval
seems a bit fickly. At least you'd need to add backslashes in front of a bunch of other characters too, not just !
and ` (
$` would be an obvious one). Better to just quote the string in the original file.– ilkkachu
Feb 1 at 14:40
Preprocessing the script to run it through
eval
seems a bit fickly. At least you'd need to add backslashes in front of a bunch of other characters too, not just !
and ` (
$` would be an obvious one). Better to just quote the string in the original file.– ilkkachu
Feb 1 at 14:40
im not sure quoting the string works, thats what im trying now, with apache configs. things would actually be really messed up if you have to escapce every wierd character. your readfile would then look like a big regex escaped mess. So it almost seems counterintuitive that it would be possible by readfile, however there must be a way. I need the readfile, when interepted by sed, to become the value of the variable, as opposed to literal
$var
. e.g. it needs to eval, but i dont like restorting to an eval()
solution either.Is that really our only option here?– Brian Thomas
Feb 9 at 5:17
im not sure quoting the string works, thats what im trying now, with apache configs. things would actually be really messed up if you have to escapce every wierd character. your readfile would then look like a big regex escaped mess. So it almost seems counterintuitive that it would be possible by readfile, however there must be a way. I need the readfile, when interepted by sed, to become the value of the variable, as opposed to literal
$var
. e.g. it needs to eval, but i dont like restorting to an eval()
solution either.Is that really our only option here?– Brian Thomas
Feb 9 at 5:17
add a comment |
If I do the following, with the value of INPUT
quoted, it works:
> INPUT='mark!slashending'
> SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
> echo $SAFE_INPUT
mark!slash\ending\
Note, it's an exact copy of your script, with INPUT=
added by me.
Hey, this is an answer that actually works, no need to even think about posting it as a comment instead of a proper answer!
– ilkkachu
Feb 1 at 14:34
This may work, but how would you then, use vars in your input string, which what im trying to do. e.g. my input string is a file path, thats evaluated by sed read, as opposed to a var of data. once sed read reads the text, i want the var evaluqated when read parses the read. Is this possible?
– Brian Thomas
Feb 9 at 5:23
add a comment |
If I do the following, with the value of INPUT
quoted, it works:
> INPUT='mark!slashending'
> SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
> echo $SAFE_INPUT
mark!slash\ending\
Note, it's an exact copy of your script, with INPUT=
added by me.
Hey, this is an answer that actually works, no need to even think about posting it as a comment instead of a proper answer!
– ilkkachu
Feb 1 at 14:34
This may work, but how would you then, use vars in your input string, which what im trying to do. e.g. my input string is a file path, thats evaluated by sed read, as opposed to a var of data. once sed read reads the text, i want the var evaluqated when read parses the read. Is this possible?
– Brian Thomas
Feb 9 at 5:23
add a comment |
If I do the following, with the value of INPUT
quoted, it works:
> INPUT='mark!slashending'
> SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
> echo $SAFE_INPUT
mark!slash\ending\
Note, it's an exact copy of your script, with INPUT=
added by me.
If I do the following, with the value of INPUT
quoted, it works:
> INPUT='mark!slashending'
> SAFE_INPUT=$(printf '%sn' "${INPUT}" | sed 's:[!]:\&:g')
> echo $SAFE_INPUT
mark!slash\ending\
Note, it's an exact copy of your script, with INPUT=
added by me.
edited Feb 1 at 14:32
ilkkachu
58.6k891165
58.6k891165
answered Feb 1 at 11:22
CornholioCornholio
1463
1463
Hey, this is an answer that actually works, no need to even think about posting it as a comment instead of a proper answer!
– ilkkachu
Feb 1 at 14:34
This may work, but how would you then, use vars in your input string, which what im trying to do. e.g. my input string is a file path, thats evaluated by sed read, as opposed to a var of data. once sed read reads the text, i want the var evaluqated when read parses the read. Is this possible?
– Brian Thomas
Feb 9 at 5:23
add a comment |
Hey, this is an answer that actually works, no need to even think about posting it as a comment instead of a proper answer!
– ilkkachu
Feb 1 at 14:34
This may work, but how would you then, use vars in your input string, which what im trying to do. e.g. my input string is a file path, thats evaluated by sed read, as opposed to a var of data. once sed read reads the text, i want the var evaluqated when read parses the read. Is this possible?
– Brian Thomas
Feb 9 at 5:23
Hey, this is an answer that actually works, no need to even think about posting it as a comment instead of a proper answer!
– ilkkachu
Feb 1 at 14:34
Hey, this is an answer that actually works, no need to even think about posting it as a comment instead of a proper answer!
– ilkkachu
Feb 1 at 14:34
This may work, but how would you then, use vars in your input string, which what im trying to do. e.g. my input string is a file path, thats evaluated by sed read, as opposed to a var of data. once sed read reads the text, i want the var evaluqated when read parses the read. Is this possible?
– Brian Thomas
Feb 9 at 5:23
This may work, but how would you then, use vars in your input string, which what im trying to do. e.g. my input string is a file path, thats evaluated by sed read, as opposed to a var of data. once sed read reads the text, i want the var evaluqated when read parses the read. Is this possible?
– Brian Thomas
Feb 9 at 5:23
add a comment |
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%2f498109%2freading-in-variables-from-a-file-to-use-in-a-bash-script-strips-out%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
1
how you are declaring
INPUT
?– msp9011
Feb 1 at 11:02
We really can't help if you don't show us how you assign a value to
INPUT
. The command you show works perfectly well if you just useINPUT='mark!slashending'
.– terdon♦
Feb 1 at 11:31
Edited to show how INPUT is loaded in.
– Gathris
Feb 1 at 11:40