662 questions
0
votes
1
answer
85
views
Handle string concatenation in worker code string
I understood that it's common sense to return the worker code as string but debugging and coding is a bit ackward this way. Such at this position, where I would like to concat several string to copy ...
2
votes
2
answers
479
views
Running a Powershell Start-Process command, with arguments containing spaces, from a batch script
I can't get this batch script to work, even though I tried a lot of things, I'm now stuck.
The intention is for the batch script to re-run itself elevated, using PowerShell and Start-Process, if the ...
-1
votes
3
answers
152
views
Unexpected output for five single quotes
There are five single quotes before and after text i like this:
h = '''''i'''''
print(h)
Output:
''i
How come?
2
votes
2
answers
312
views
Connect to Postgres Flexible Server via "az postgress" from PS1 Script when Password has characters needing escapes
I want to run a command on Azure Postgres Flexible Server via a PS1 (PSCore) script. The password can contain characters like < and ) that the PSCore parser chokes on.
I'm attempting to use the az ...
1
vote
1
answer
88
views
Docker Compose mangling YAML, how do I see the YAML it renders?
My Docker Compose is acting up, starting from https://stackoverflow.com/a/30064175, I have something like:
services:
stuff:
image: alpine
entrypoint: [ "/bin/sh", "-c" ]
...
1
vote
1
answer
90
views
Powershell Argument was missing the terminator: "
I am having problem with powershell arg design like this
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& { $scriptContent = Get-Content -Path 'C:\path\to\your\script.ps1' -Raw; $...
0
votes
0
answers
65
views
Why is dash quoting different in script and interactive?
I hope I have not fallen victim to the intricacies of shell expansion, but to me it seems dash treats quoting different depending on whether it's on an interactive command line, or in a script.
I have ...
0
votes
0
answers
42
views
how to expand a string in bash so that it evaluates to a pipeline [duplicate]
Suppose I have the following variable in a bash script cmd='echo hi | wc'.
Since I forgot how many characters are in the string "hi", I want to run cmd.
I expected this be as simple as ...
2
votes
1
answer
106
views
How can I fix conflicting symbols between git and powershell?
When I’m specifying gitrevisions in pwsh (eg HEAD@{3}), I have to conditionally remember to surround the gitrevision with quotes. If I don’t, it treats “@“ as an array sub-expression operator.
Example:...
0
votes
2
answers
245
views
zsh brace expansion for argument containing spaces supplied from a variable
In zsh, how can I use brace expansion for an argument containing spaces supplied from a variable?
e.g., I want to rename a file from ~/a b/1.txt to ~/a b/2.txt.
I can do this manually from the command ...
2
votes
2
answers
285
views
How to pass PowerShell string parameter that has both `(backtick), ' and " inside?
I am executing a Python script using a PowerShell command, The Python script takes a string that could contain special characters inside it. This parameter is passed from an ansible pipeline. The ...
0
votes
1
answer
39
views
cant put substraction character as string
I am trying to write a bash script to create a filename using some variables, I should add "-" character in some places to obtain the correct filepath. However when I use the following ...
0
votes
1
answer
34
views
Invoking command with arguments from variable
I have a list of arguments, some which contain spaces, stored in a variable. When the command is invoked the arguments are not interpreted correctly. Here is a minimal example which illustrates the ...
2
votes
1
answer
155
views
Remove auto single quotes in GNU Parallel
I'm running this command, to change "Text to replace" in text files with the basename the text file:
parallel --dry-run sed -i \"s/Text to replace/{.}/\" {} ::: *.txt
However, ...
0
votes
1
answer
357
views
How do I make chroot run a command in the same directory in the new rootfs as I am in now?
I have various other Linux distros on other partitions and am trying to write a command called "on" that will run a shell command in that distro as the same user and in the same directory as ...
2
votes
2
answers
244
views
Variable substitution inside if statement
I have the following bash script that I do not have control over:
set -x
echo "$CMD"
if ${CMD}; then
echo "Success"
fi
I'm trying to run the following command: bash -c "...
1
vote
0
answers
756
views
Passing go -ldflags as an argument to Dockerfile
I have a Dockerfile where I'm building the image from go source and I need to pass the -ldflags as an argument to the go build command. Below is a snippet of the Dockerfile:
// from statement and ...
1
vote
1
answer
159
views
Powershell: how escape many special chars as data, not operators?
Got a problem understanding how to escape out chars in PS, so they are not interpreted as operators or instructions. I'm writing a PS script to find chars in filenames which are to be forbidden, and ...
1
vote
1
answer
63
views
Cannot handle properly csv.writer escapechar and quoting parameters
I am developing a python script which,
given:
the path of a csv file
a list of names of some of the columns of the csv file
a string to-be-replaced (A)
a string to-replace-with (B)
should:
...
19
votes
2
answers
39k
views
Python 3.12 SyntaxWarning: invalid escape sequence on triple-quoted string, `\d` must be `\\d`
After updating to Python 3.12, I get warnings about
invalid escape sequence on some triple-quotes comments.
Is this a new restriction? I have the habit of documenting code using triple-quoted string, ...
1
vote
1
answer
48
views
csv writer in python adding double quote when copying data from another csv file, So I just need to know how to copy exactly the same data
#Reading from csv file
with open('py_csv/oscar_age_male.csv','r') as csv_file:
csv_reader=csv.reader(csv_file)
#Creating new file and opening it and changing delimiter
with open('py_csv/...
0
votes
1
answer
117
views
Getting "invalid escape sequence" trying to escape double-quote in string literal
How do I use HTML that has double quotes ("") in a Swift Playgrounds (iPad) WKWebView?
I tried to do it this way using \ before the quotes:
Note, this was done in a playground, not an app.
...
0
votes
1
answer
84
views
macOS bash globbing quoted variable unexpectedly [duplicate]
On Linux with bash 5.2.15, single quotes prevent globbing as expected:
Good
$ dir='/path?/to?/file?'; echo $dir
/path?/to?/file?
$
However, on macOS with bash 3.2.57, I get this undesirable behavior:
...
3
votes
1
answer
2k
views
Save a Pandas DataFrame to a CSV file without adding extra double quotes
I want to save a Pandas dataframe to a CSV file in such a way that no additional double quotes or any other characters are added to these formulas. Here is my attempt:
import pandas as pd
data = {
...
0
votes
2
answers
48
views
How can you double quote a shell variable in a command line only if the variable is set?
I need to execute a bash command where, only if a variable is set, I want to include that variable on the command line. The trick is that the variable could have a space in it, and the variable must ...
0
votes
1
answer
140
views
SAS Rename of file with open parentheses
I have a large number of Excel files to be processed. I've created code that reads their names into a dataset for execution of each file. Each of the files, unfortunately, has an open left parentheses ...
1
vote
2
answers
224
views
powershell oneliner inside of batch loop
I have following loop:
for /f "tokens=1-3 delims=- " %%a in ('
powershell.exe -Command "Get-EventLog -ErrorAction SilentlyContinue -Newest 1 -LogName System -EntryType Error -Source ...
1
vote
2
answers
787
views
How to escape pipes in Maven argument string in Powershell
I am trying to make the following command work in Powershell:
mvn -Dhttp.nonProxyHosts='xxx.xxx.*|*.example.com|*.example2.com|localhost|127.0.0.1' -DskipTests clean install
This command works fine ...
0
votes
0
answers
21
views
Create Object in Custom Function, Issues with Quoting [duplicate]
I am trying to calculate a survival function over multiple variables, one of which is fu_time_PJP and fu_status_PJP. Here is the function, which works great under those paramaters:
km_time <- ...
0
votes
1
answer
355
views
Launching a batch file with elevation via a PowerShell command from VBS
any idea to fix the following that I have with my script?
Set objShell = CreateObject("Wscript.Shell")
objShell.Run("powershell -Command "Start-Process 'cmd' -Verb RunAs -...
0
votes
1
answer
262
views
why tell the key must be a string when request rust rocket api
I am learning using rust to write a rest api to update some record. I have defined a rust(v1.69.0) rocket api like this:
#[macro_use] extern crate rocket;
use rocket::{serde::json::Json, response::...
0
votes
0
answers
132
views
R - Pass variable to a function
In R, I am running a for loop and in each loop I create a variable (var) by referring to the value in a column in a dataframe (dataframe is called temp).
I then want to pass this variable (var) as one ...
1
vote
1
answer
1k
views
httpx/URL is changing original URL
If I have %20 in URL before, it ends up with + in the code.
url='http://www.example.com?param=a%20b'
url=URL(url)
url=url.copy_merge_params(params={})
In QueryParams.str it's invoking urlencode() ...
1
vote
2
answers
419
views
How to pass a Bash command to `entr`, quoting to guard against filenames with spaces?
My Goal
I'm writing a small Bash script, which uses entr, which is a utility to re-run arbitrary commands when it detects file-system events. My immediate goal is to pass entr a command which converts ...
0
votes
2
answers
47
views
Subtraction expression in CodeIgniter query builder where() call receives inappropriate auto-quoting
public function semua_data1()
{
$this->db->select('*');
$this->db->from('tbl_m_stock');
$tgl = date('Y-m-d', strtotime("-365 day", strtotime(date('Y-m-d'))));
$...
1
vote
1
answer
461
views
Not quoting $input in Powershell, and its value is "Current"
I was writing a PowerShell script, and forgot to quote $input when piping to a command. The command unexpectedly appeared to receive the string Current on stdin, so I investigated further and typed ...
-3
votes
2
answers
178
views
Quote tags in Hugo frontmatter (regex help!)
In the process of converting a blog from WordPress to Hugo, I find that I need to do a global search and replace for tags to convert them to a list of strings.
Currently I have something like this:
...
0
votes
2
answers
3k
views
Powershell not accepting normal quotation marks
I've been pulling my hair out all day because of this issue.
I'm working on a powershell one-liner and Powershell is being picky with what quotation mark I use. “ vs ", with powershell requiring ...
0
votes
1
answer
102
views
How to not escape pipe redirection symbols in Cygwin
I’ve got build scripts working perfectly for Linux bash. Currently I’d like to adapt build for Cygwin, to make it cross-platform. The problem is the build script uses pipe redirection like | and >, ...
1
vote
2
answers
88
views
Quoting options with mixed strings and multiple vars?
Goal:
I have a sneaking suspicion that I'm globbing incorrectly due to not being able to find a satisfactory explanation with multiple clear examples of advanced string-and-var mixing.
The operation I ...
-1
votes
2
answers
1k
views
Broken JSON using JQ processing: Possible Bug?
I have a JSON I found that seems to fail to be able to remove an Array after indexing once. Here is the valid JSON below (according to jsonlint.com
Goal: Remove an outer array from what {was a valid ...
1
vote
1
answer
104
views
How can I execute this line of code in the run box?
I have the following line of code that I use to download and combine dns text records from my website and execute them in powershell. I can run this command just fine from the console but can not ...
15
votes
1
answer
3k
views
PowerShell 7.3.0 breaking command invocation
I use WinSCP within a Powershell script. It suddenly stopped working. After a while I could figure out that the problem appeared from a more recent version of PowerShell:
Reduced code:
& winscp `
...
0
votes
4
answers
87
views
Passing quoted aurguments to bash function using a variable
I am using bash and trying to do pass quoted arguments to a function using a string variable and it fails.
myfunc() {
for myarg in "${@}"
do
echo ">$myarg<&...
0
votes
1
answer
172
views
Capturing text of function call in r
I have a function rts() which generates a couple of different charts and displays the raw data they are based on. The argument is another function, raw_data(), which filters a larger data set based ...
-1
votes
1
answer
1k
views
Unexpected token '}' when passing string to PowerShell script
I have a script that accepts two strings, each are delimited by '|-|'. The second string can contain any character other than '.
To call the script I do:
PowerShell .\script.ps1 -arg1 'Hello|-|World' -...
1
vote
1
answer
67
views
Clojure: quote vs syntax quote evaluation order
I'm trying to understand quoting in clojure and came across this article. While trying out the examples, I'm confused about the order of evaluation of quoting expressions.
`(~`'baz)
;; ↪ ('user/baz)
`...
1
vote
1
answer
250
views
Using sed doesn't replace and there is no error too
I'm using Windows 10 x64, Powershell Core 7.2.6, and /usr/bin/sed (GNU sed) 4.8 installed with Git for Windows. No WSL at all.
I have a .env file like this.
ENDPOINT="localhost:3000"
and I ...
1
vote
1
answer
1k
views
variable inside brackets powershell [duplicate]
I am struggling on this for hours now ...
Its a syntax question basically how do I make this work : $test = '{"Title": $name}'
The $name is not recognize as a variable.
this is a simple ...
1
vote
2
answers
126
views
Dollar in conditional variable assignment operator in Makefile
Is it possible to pass value with single dollar from shell to Makefile, or I it is only way to put double dollar in bash and then to call make?
Makefile is:
HASH ?= $$6$$salt$$val
.PHONY: tst
tst:
...