Skip to main content

Questions tagged [quoting]

The use of quotation marks (typically, `'` or `"`) to mark tokens as string literals or strings subject to interpolation, or to treat multiple whitespace-separated tokens as a single unit.

0 votes
0 answers
37 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 ...
Mark VY's user avatar
  • 1,623
1 vote
1 answer
60 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:...
Qubitz's user avatar
  • 13
0 votes
2 answers
92 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 ...
XDR's user avatar
  • 4,349
2 votes
2 answers
66 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 ...
Praveen Dinelka's user avatar
0 votes
1 answer
32 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 ...
Yagmur CA's user avatar
0 votes
1 answer
21 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 ...
August Karlstrom's user avatar
2 votes
1 answer
40 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, ...
Geremia's user avatar
  • 5,364
0 votes
1 answer
117 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 ...
martinwguy's user avatar
2 votes
2 answers
111 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 "...
Yeti's user avatar
  • 883
0 votes
0 answers
251 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 ...
Cheshar's user avatar
  • 579
1 vote
1 answer
81 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 ...
Kaley's user avatar
  • 33
1 vote
1 answer
41 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: ...
Tms91's user avatar
  • 3,921
9 votes
2 answers
12k views

Python3.12 SyntaxWarning on triplequoted 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, ...
MortenB's user avatar
  • 3,222
1 vote
1 answer
36 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/...
Md Aatif Hasan's user avatar
0 votes
1 answer
51 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: ...
Bill Wohler's user avatar

15 30 50 per page
1
2 3 4 5
41