I am trying to set an environment variable in firebase functions like this:
firebase functions:config:set clientsecret="abc123$efgh"
However, when I use:
firebase functions:config:get
I am seeing all of my settings, but it looks like my clientsecret value is getting truncated after the $ character.
{
"myservice": {
"clientid: "1234567"
"clientsecret": "abc123"
}
}
Is there a way I should be escaping or encoding the $ so the entire string is stored? Thank you for any suggestions!
The problem isn't with Firebase or Cloud Functions. The problem is the $ character. That's a special shell character that takes the letters after it and assumes it's a shell variable. So, your command is telling the shell that you want to insert the value of variable efgh into the command line. Since that variable is probably not defined, you're getting an empty string in its place. So, $efgh is yielding an empty string.
If you want to use $ in a shell command line like this, you're going to have to escape it. There is a lot to know about this. Maybe the easiest thing is to simply escape the $ itself with a backslash:
firebase functions:config:set clientsecret="abc123\$efgh"
Related
I'm trying to send query to my Mongo database depending on a variable producted in my R code.
Unfortunately, Mongo query needs double quotes and the function "paste" in R doesn't support it.
Here my variable is equal to "test01" but it will change at each iteration.
I tried to build a great character chain named "req" thanks to some "paste" functions with returns:
req
> "'{\"id\":\"test01\"}'"
cat(req)
> '{"id":"test01"}'
Which seems to be as a query but when I try :
connection_db$count(jsonlite::toJSON(req))
It returns [0] whereas if if try :
connection_db$count('{"id":"test01"}')
It returns [1].
Can you help me please?
I am using Gremlin java and I found GroovyTranslator adds additional \ before $ sign,
and this causes query failing to execute on remote server.
GraphTraversal traversal = graph.addV().property("amount", "$1");
System.out.println(GroovyTranslator.of("g").translate(traversal.asAdmin().getBytecode()));
Translated result:
g.addV().property("amount","\$1")
If this is issue with GroovyTranslator, i can replace \$ with $, but I am not sure if more special characters will have this issue.
This fails because of backslash, but what if some property value want to use backslash?
From what I see, use backslash will always fail.
I suppose following should work but it doesn't:
curl -X POST -d '{"gremlin":"g.V().has(\"key\",\"\\$\")"}' ...
In Groovy the dollar sign has special meaning if you are using Groovy Strings (GStrings). It is used to indicate interpolation should occur as in :
gremlin> a=3
==>3
gremlin> "The number is $a"
==>The number is 3
If the server you are connecting to uses Groovy as-is to parse the query then the backslash is needed. If the server does not use Groovy as-is then you will need to remove the backslash.
There are a few other things to be aware of with GroovyTranslator. When it generates literal numbers it puts a cast such as (int) 3 into the query. You may need to also remove these depending on the back end graph database you are connecting to.
Situation.. I have two tags defined, then I try to output them to the console. What comes out seems to be similar to an array, but I'd like to remove the formatting and just have the actual words outputted.
Here's what I currently have:
[Tags] ready ver10
Log To Console \n#{TEST TAGS}
And the result is
['ready', 'ver10']
So, how would I chuck the [', the ', ' and the '], thus only retaining the words ready and ver10?
Note: I was getting [u'ready', u'ver10'] - but once I got some advice to make sure I was running Python3 RobotFramework - after uninstalling robotframework via pip, and now only having robotframework installed via pip3, the u has vanished. That's great!
There are several ways to do it. For example, you could use a loop, or you could convert the list to a string before calling log to console
Using a loop.
Since the data is a list, it's easy to iterate over the list:
FOR ${tag} IN #{Test Tags}
log to console ${tag}
END
Converting to a string
You can use the evaluate keyword to convert the list to a string of values separated by a newline. Note: you have to use two backslashes in the call to evaluate since both robot and python use the backslash as an escape character. So, the first backslash escapes the second so that python will see \n and convert it to a newline.
${tags}= evaluate "\\n".join($test_tags)
log to console \n${tags}
Is it possible to disable Command Substitution in Bash?
I want to pass a string containing several backticks characters as command-line argument to a program, without trailing backslashs or quoting the string.
Thank you.
I assume there is a misconception which grounds your question. Quoting is most likely the solution to your situation. But maybe you haven't found the right way of quoting yet or similar.
If your dangerous string shall be verbatim (without quoting or escaping) in the source code, you can put it in a separate file and read it from there:
dangerous_string=$(cat dangerous_string_file.txt)
If it shall be passed without interpretation to a command, use the double quotes to prevent interpretation:
my_command "$dangerous_string"
If you have to pass it to a command which needs to receive a quoted version of your string because it is known to carelessly pass the string without using sth like the double quotes to prevent interpretation, you can always use printf to get a quoted version:
quoted_dangerous_string=$(printf "%q" "$dangerous_string")
careless_command "$quoted_dangerous_string"
If all these options do not help in your situation, please explain in more detail where your problem lies.
I run exe from my asp.net with JavaScript using ActiveXObject. It runs successfully, except parameters:
function CallEXE() {
var oShell = new ActiveXObject("Shell.Application");
var prog = "C:\\Users\\admin\\Desktop\\myCustom.exe";
oShell.ShellExecute(prog,"customer name fullname","","open","1");
}
Example, I pass that like parameters,[1] customer name,[2] fullname, but after space character, Javascript perceive different parameter.
How can I fix?
ShellExecute takes the 2nd parameter to be a string that represents all the arguments and processes these using normal shell processing rules: spaces and quotes, in particular.
oShell.ShellExecute(prog,"customer name fullname",...)
In this case the 3 parameters that are passed are customer, name, fullname
oShell.ShellExecute(prog,"customer 'a name with spaces' fullname",...)
As corrected/noted by Remy Lebeau - TeamB, double-quotes can be used to defined argument boundaries:
oShell.ShellExecute(prog,'customer "a name with spaces" fullname',...)
In this case the 3 parameters that are passed are customer, a name with spaces, fullname
That is, think of how you would call myCustom.exe from the command-prompt. It's the same thing when using ShellExecute.
Happy coding.
Try escaping your spaces with a backslash. The cmd.exe cd command does this, maybe you'll get lucky and it'll work here as well...
oShell.ShellExecute(prog,"customer a\ name\ with\ spaces fullname", ...)