5,750
questions
0
votes
0
answers
64
views
Bash error trap does not catch stderr output after redirection to file
In my bash script I redirected stdout and stderr to a logs file to prevent it from being printed in the terminal.
I set my script to exit on error occurrence using set -e switch.
Now, whenever any ...
1
vote
2
answers
46
views
bash script to Echo multiple lists
i need to echo multiple list like this
list_0=(1 2 3 4 5 6)
list_1=(7 8 9)
list_2=(22 7 34 88)
.....
.....
list_99=(23 67 80)
I have this version that works but every time I have to declare new list ...
1
vote
1
answer
76
views
How to replace random lines with empty string 30% of the time in bash?
Assuming that I created a file with 10 lines:
yes "foo bar" | head -n 10 > foobar.txt
[out]:
foo bar
foo bar
foo bar
foo bar
foo bar
foo bar
foo bar
foo bar
foo bar
foo bar
And I want ...
1
vote
0
answers
26
views
Laravel Echo is undefined
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1....
-1
votes
2
answers
84
views
BASH: Assign values to variables with echo | sed | read [duplicate]
I'm trying to pass a string through a pipe going from echo to sed to read, but something isn't working:
#!/bin/bash
STR="alef|bet|gimel|daled"
echo $STR
echo $STR | sed 's/\|/ /g' | read ...
-1
votes
3
answers
46
views
Clarification on how PHP handles true and false values
I would like to use a true/false result to do alternative things in PHP. I was surprised by the following:
$falsevar = false;
$truevar = true;
echo "falsevar which I just set to false is".$...
1
vote
1
answer
378
views
Laravel 11 Reverb: WebSocket Connection failed
WebSocket connection to wss://subdomain.domain.com/app/... failed
Its working on locally without any issue but in production it gives issue
here is my .env for production
REVERB_APP_ID=401132
...
0
votes
1
answer
41
views
Building arrays in command line and calling them in a for loop as a single command
I am trying to build two arrays (arr1 and arr2 which will have the same length) in the command line to be referenced in a for loop.
Building the command like this from the script,
set arr1[0]="a&...
0
votes
1
answer
53
views
Bash Command Substitution in echo/printf doesn't print result on the same line? [duplicate]
Reproducible example
Consider this example:
#!/usr/bin/env bash
echo "[Status] $(killall --wait example)"
Expected output:
[Status] example: no process found
Actual result (being wrong ...
0
votes
1
answer
43
views
How do I keep the mysql client from echoing commands?
The mysql client on my Macbook echos command lines. Even when I turn echoing of command lines off in the shell, when I start up the mysql client it immediately begins echoing them. Then when I exit ...
2
votes
2
answers
66
views
How to cat text string and file in bash in way to preserve literal \newpage in output?
I have multiple markdown files that I am trying to concatenate into one markdown file in bash. I can concatenate markdown files and preserve “\newpage” lines, but when trying to add a group title via ...
1
vote
0
answers
31
views
Echo not printing CDATA tags in Wordpress
I am creating a RSS feed in WordPress. In my functions.php, I have
$content = htmlentities(strip_tags(get_the_content()), ENT_XML1, 'UTF-8');
echo '<description><![CDATA[' . $content . ']]>...
1
vote
2
answers
180
views
Does the echo command in Bash shell ever write anything to stderr without an explicit redirect of the output? [closed]
Plenty of other commands/binaries would (for example wc --wrong-flag) but is echo one of them?
Context: I am maintaining somebody else's Bash script, looking at the following section of it (slightly ...
2
votes
1
answer
815
views
How to Live Reload golang REST project like nodemon in nodejs?
I want to run golang REST api project in echo labstack.
for development purpose i want that when i save file it automatically refesh the api's in VS code like nodemon does in nodejs.
i am trying to go ...
0
votes
0
answers
65
views
How to reduce noise in recordings with a known audio file
I have a microphone and speaker connect to a RPI inside an art sculpture, my objective is to record new audio clips of people talking into the mic while playing back 3 random recorded audio clips. It ...
0
votes
0
answers
26
views
Trying to echo line variable along with another variable inside a while read loop
Am trying to echo a line variable along with another variable like below
while read -r line;do
id1=$(echo "$line"|grep...)
id2=`grep "$id1"...."
echo "$line" , "...
0
votes
1
answer
103
views
How to preserve newline characters in CSH when storing in a variable or echo
I have a python script which is getting called from a csh script ( I can not use bash). The python script prints out string with the newline characters and I am storing the output in a csh variable. ...
1
vote
1
answer
99
views
MSTeams echo bot using PowerShell Azure Functions
How should one parse the chat text received as JSON payload in the request body when using an outgoing webhook as an application in a Teams group to fetch the output of a PowerShell Azure function?
...
-2
votes
3
answers
632
views
Echo -e on MacOS [closed]
I have a problem with script constantly printing signs \n. My script is made for bash and is set to posix=yes. When I ran program on Mac the printing to bash is done only by echo "text here"....
1
vote
0
answers
42
views
Difference between tcsh and bsd-csh in terms of use of square brackets in echo
I have two simple Shell scripts that essentially do the same thing (i.e., printing all arguments), as are shown below.
S1:
#!/usr/bin/tcsh
echo [$argv[*]]
S2:
#!/usr/bin/bsd-csh
echo [$argv[*]]
S1 ...
1
vote
1
answer
85
views
JSON String processing injects quotes
I get json encoded secrets from a Vaulwarden-Instance by their UUID.
I want so loop over any uuid and set environment variables accordingly.
For every field there should be variable (see below)
...
0
votes
1
answer
48
views
Can you have 2 queries on different tables to create check boxes and have them "checked"?
I am currently using a table that uses a show columns query to echo all the columns into checkboxes. The below code works for that. I tried to create another query right under the query to search a ...
0
votes
0
answers
41
views
Can a csh script be made to "Not Execute" the date command in an echo statement
I have a cron task that captures log files every six hours. We have a post installation script that executes after we do an install and this script builds the crontab. It is a csh script that uses the ...
3
votes
1
answer
1k
views
How to install templ in macos. Error:- templ not found
docs says.
go install github.com/a-h/templ/cmd/templ@latest [This does not work.]
what I did.
1.
git clone https://github.com/a-h/templ.git [in /tmp]
cd cmd/templ && go install
still Error....
1
vote
0
answers
113
views
Exposing API endpoints in Wails with Axios (404)
I'm creating a desktop app using Wails with React.JS, I have a simple endpoint I want to expose, I'm using Axios to make requests from the React.JS Component, in the backend, I'm using echo to expose ...
0
votes
0
answers
214
views
zsh prompt in read/echo for variable input
I want to make a script for zsh command line. It is a separate .sh file, I launch it through bash myscriptname, it asks me to input some values for variables and provides a result.
The problem is the ...
1
vote
1
answer
109
views
Pipe an output into echo as an variable for calculation
My goal is to divide 2 text files, each containing a single integer,
but limiting the answer to 2 decimal places.
I managed to do it with paste total.txt count.txt | awk '{printf "%.2f\n", $...
1
vote
1
answer
50
views
Bash and echo command unexpected results
I am running an echo command in bash and I am seeing some unexpected results.
When running:
echo "{
"outputs": {
"result": "[{\"directory\":\"...
1
vote
1
answer
96
views
character-escaping double quotes in bash append file of command and output
I work with a variety of diagnostic files (text / jq for JSON / yq for YAML / xpath for XML, lnav for log files) in Bash where I need to dynamically determine meaningful data parsing before reporting ...
1
vote
0
answers
151
views
Error fetching data: SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>)
im having problems with gorilla sessions mainly, but with nextjs and frontend too, i can fetch all my data with no problem, but when i try to send the user to the front end from the gorilla session ...
0
votes
0
answers
113
views
Python driven Alexa announcements
I have a python script that runs on my pc, monitors web data and occasionally prints an alert. I would like to feed this string to alexa so the alert is announced on all my echo devices. How can I ...
0
votes
2
answers
95
views
Bash IFS causes unexected results with array output
When IFS has its default value and an array is printed without quotes, the interpreted value doesn't have quotes, but when IFS doesn't have a space it it, it does.
Using an echo web server and curl to ...
-2
votes
1
answer
285
views
Suppress the output of the RUN command in a Dockerfile
How can I suppress the output of the RUN command in a Dockerfile? In the code below, I'm attempting to redirect the SSH_PRIVATE_KEY to a file using the echo command. However, during image building, ...
2
votes
1
answer
203
views
What is the minimal GDScript equivalent of Python websocket client code?
I'm attempting to program a simple turn-based game in Godot which relies on a Python websocket server for rules and state updates. To that end, I'm trying to make a simple prototype where I can input ...
-1
votes
1
answer
57
views
/CLOSED/ Why does it say ECHO is off? [closed]
set /a swordparts=1
If (%swordparts% GTR 0) (
echo %swordparts%
)
it outputs ECHO is off. whats going on here?
I thought it would say 1, as %swordparts% is greater than 0 and equals 1, and when %...
-1
votes
1
answer
87
views
HeIp with pip and setx
I am trying to run pip install -r requirements.txt but it says pip is not recognized as an internal or external command, operable program or batch file.
I searched and learned i need to add it to my ...
0
votes
1
answer
86
views
run additional php code in echo after replacing strings
i want to execute addition php code after replacing some string from form
here os my form code on form.php
<form method="post" action="result.php">
<input type="text&...
0
votes
2
answers
139
views
Can I echo the alias text every time I run them without running into pipeline issues?
For learning purposes, I would like to automatically print out the aliases I use each time I run them. My hope is that it will help me learn what some of the useful flags involved in the commands do, ...
1
vote
1
answer
78
views
How do I use a user input and insert it in a pre-determined text in a batch file
I am trying to catch the user input and add it to specific text, which will be sent to the clipboard.
@echo off set /p TICKETID="Enter Ticket #: "
echo Here is the ticket for you, thanks : ...
0
votes
0
answers
29
views
Write javascript variables directly or load via AJAX [duplicate]
We have a one page application that needs to load about 100 user specific data points into Javascript variables that are not required for the initial painting of the page.
Is it better to load the ...
0
votes
1
answer
81
views
Why is my script cutting off the last input value?
I have this script:
#!/bin/bash
#set -x
OLD_IFS=$IFS
counter=0
while [ $counter -lt 2 ] && IFS= read -r -p "Enter row $(($counter+1)): " row; do
echo "whole row: $row"...
0
votes
2
answers
104
views
Escaping dot in if-statement with echo in Windows batch
I have a chicken-and-egg issue: I need to echo a dot in an if statement in a batch script, but the command prompt crashes, saying '. was unexpected at this time.'
Note that echoing treats everything ...
-1
votes
1
answer
76
views
Unable to redirect variable's value to file using ansible copy module [closed]
I have taken just a sample from a huge data that I wish to read from variables and dump in the file.
cat junk.txt
{:,:"(s):"}}
This data in the junk is not in my control and comes as ...
1
vote
4
answers
444
views
Print all the usernames of users as well as their home directories
I'm trying to print all the usernames of users as well as their home directories. All I have found online is how to change the passwords etc. Could someone please guide me to figure this out?
echo $...
0
votes
1
answer
47
views
I tried this code to print out prime numbers up to a given amount, but I keep running into bugs
I tried this code to print out the prime numbers up to a given amount, but i keep running into bugs
echo "enter range: "
read n
echo "prime no are:"
m=2
while [ $m -le $n ] do
i=2 ...
0
votes
2
answers
636
views
echo 'hello' vs echo "hello" vs echo hello, which should I use in a Bash script? [duplicate]
Which characters should I use among {"", '',} when writing the echo command?
Obviously:
echo hello
echo "hello"
echo 'hello'
all three do not produce errors and perform what ...
-2
votes
2
answers
136
views
PHP echo multidimensional array next to each other instead underneath each other
Here is my problem.
I have created two bunny's with character and want to display them, als with PHP.
For the two bunny's I created a multidimensional array:
$bunnys = array(
array( //$...
2
votes
1
answer
129
views
Why does "echo 123 > a.txt b.txt" only create one file?
When I execute echo 123 > a.txt b.txt I expect to see 123 written to two files, a.txt and b.txt. But the actual result is that only one file is created. The content 123 b.txt is written in the file ...
0
votes
0
answers
135
views
NextJS doesn't set cookie from backend (nextjs, echo golang)
nexjs frontend:
async function getData() {
const res = await fetch('http://localhost:3001/', {
credentials: 'include'
})
if (!res.ok) {
throw ...
-1
votes
1
answer
57
views
"echo" this special escaped char in bash [duplicate]
I am struggling to print out (i.e. echo) the non-ASCII Unicode character "Latin Capital Letter C with Caron" U+010C.
As can be seen in my online Python IDE, the code compiles and prints the ...