Skip to main content
2 votes
1 answer
77 views

Is there a functional difference when piping a shell variable with printf or using a heredoc and expanding the variable inside the heredoc? Piping: txt=… printf '%s\n' "$txt" | xxd Heredoc: ...
knittl's user avatar
  • 270k
2 votes
1 answer
39 views

I'm using PHP 8.2. I have the following heredoc: $a = 4; $b = 2; $str = <<<EOT $a + $b = {$a + $b} EOT; print $str; Error: PHP Parse error: syntax error, unexpected token "+", ...
John Cowan's user avatar
  • 1,764
4 votes
4 answers
208 views

I recently tried to use the <<- operator for heredocs in bash to keep indentation in my bash functions: cat <<- EOF Hello World EOF However it turns out this only strips literal tab ...
glades's user avatar
  • 5,390
0 votes
1 answer
141 views

I created some Terraform code for Uptime Checks in Google Cloud Plattform. But after doing an terraform plan the content_matchers block content attribute is always shown as something Terraform is ...
saturn-thmx's user avatar
-1 votes
2 answers
80 views

I am trying to create a shell script that goes multiple times through a program and calculates me some physical parameters. The program is opened in the console with "./radex" and afterwards ...
GhastM4n's user avatar
0 votes
1 answer
47 views

I have several multiline strings with indentation in my code, such as this (simplified example): def foo(): cmd = '''ls /usr/bin /usr/sbin /usr/...
Timur Shtatland's user avatar
1 vote
1 answer
659 views

I would like to create a file using heredoc and then run a command after in the same RUN statement in a Dockerfile. To illustrate, take this Dockerfile FROM alpine RUN export FOO=bar && \ ...
Hans Kilian's user avatar
  • 26.6k
0 votes
0 answers
29 views

I have the following script and when I run it, I don't get the expected output to the local terminal. I am assuming it must be the variables that I am assigning in the heredoc that is not getting ...
JKC's user avatar
  • 23
0 votes
1 answer
182 views

I currently use many heredocs in bash scripts. These heredocs contain bash variables, e.g. ${MY_VAR}, which are substituted as the script executes and the heredoc is read. Some of these heredocs have ...
fadedbee's user avatar
  • 45.2k
0 votes
1 answer
325 views

I want to use a class constant in heredoc which is used in an annotation, but that gives me an error. class Example { #[MyAnnotation(schema:<<<YAML type: {${MyOtherClass::A_CONSTANT}} ...
MarkovIV's user avatar
1 vote
3 answers
946 views

Due to some constraints, i have to transfer local file to remote ssh with only echo and cat command and here-document. I've tried: #!/bin/bash SSH_CMD=xxx # suppose `SSH_CMD` is my ssh command w="...
LimingFang's user avatar
0 votes
0 answers
32 views

I understand that calling PHP functions within HEREDOC strings can be tricky and I have looked at some of the previous answers on here and tried to implement them without success. I have a function ...
Chris Dormani's user avatar
0 votes
3 answers
349 views

I have a script. I can't print $ in a screen. #!/bin/bash SERVER_IP="" PASSWORD="" DOMAIN="" CONFIG_CONTENT=$(cat << EOF server { listen 80; listen [::]:...
Artem's user avatar
  • 3
2 votes
3 answers
417 views

I want the ability to pass a heredoc to the source command for local interpretation. The body of the heredoc document will be injected later before calling the script, and can be multiline. I came up ...
Danilo Pianini's user avatar
0 votes
1 answer
254 views

In a POSIX shell (let's consider bash in this example), whenever we run cmd << eof, the shell expects input until a string containing only eof is received. Also, the standard states that: If ...
iury's user avatar
  • 3

15 30 50 per page
1
2 3 4 5
53