Questions tagged [echo]

Simple function outputting text. Exists in script languages.

echo is mainly used in batch (cmd). An example would be:

echo hello world

which prints "hello world" to the terminal.

The output by default prints directly to the command line, however, it may be piped into a following command as an input. This can be very handy and allows for interoperability between different processes/languages.

5742 questions
1
vote
1 answer

Can someone tell me, why this batch script isn't working?

@echo off :start SET /A number=%RANDOM% * 3 / 32768 + 1 echo %number%>number.txt PING localhost -n 2 >NUL goto start It should generate a random number from 1-3. And it does. But the .txt file is just empty and in the console, I get the message:…
Kevin Mueller
  • 628
  • 3
  • 10
  • 23
1
vote
1 answer

Return in recursive function PHP laravel

im working with laravel and php, im doing a recursive function, the problem is that the return value of the function doesnt work just work echo. The code is the this. public function getSitioPadre($id){ $padre = …
bjesua
  • 319
  • 1
  • 4
  • 14
1
vote
1 answer

Formatting double quotes string with functions

I am trying to learn to write more advanced strings. I know I could do this using three different statements, as such: To get a result like this: result1 | result2 (my real world example for this is…
zver
  • 33
  • 3
1
vote
1 answer

RecursiveDirectoryIterator to echo list separated by folders

is there any way for RecursiveDirectoryIterator to echo files in subfolders separately based on folder and not all together? Here is my example. I have a folder (event), which has multiple subfolders (logo, people, bands). But subfolder names vary…
John K
  • 105
  • 7
1
vote
1 answer

How to echo predefined variable from PowerShell command line?

I'm able to Write-Host a custom variable from PowerShell command line, but predefined variables are not working with same way. What is proper way to echo a predefined variable. Write-Host $path works. Write-Host $PSScriptRoot does not. Here is my…
1
vote
1 answer

echo item according to session result quantity

I want to fetch and echo item from MySQL database multi-times according to session quantity. Example : id | qty | item 1 | 2 | shoe 2 | 4 | net 3 | 3 | phone My result set should be like this : shoe, shoe net, net,…
1
vote
1 answer

How do I change the background image on an Alexa Show skill card?

I'm new to programming Alexa skills, especially with the Echo Show. I am trying to change the background image of the skill card from the default dark grey to something else. I know there has to be a way to do this because when I say, "Alexa, tell…
maestro777
  • 161
  • 1
  • 2
  • 17
1
vote
2 answers

How to echo multiple div?

I want to echo this html code but unable to this code:
Iam Srkfan
  • 197
  • 9
1
vote
2 answers

Echo is not working correctly in my Windows Batch script

Main Problem: The ECHO command ignores all characters before the token argument and inserts all text after the token argument before the token in the output: Here's the script: @ECHO OFF FOR /F "USEBACKQ TOKENS=2 DELIMS==" %%a IN (` WMIC NIC…
Rhyknowscerious
  • 260
  • 6
  • 12
1
vote
0 answers

echo does not print line breaks at the end of a variable

I am trying to print the content of a variable in a bash script. I need all the line breaks just as in the string, especially in the end of it. Given an example file: $ touch test.txt $ echo "A" >> test.txt $ echo "B" >> test.txt $ echo "C" >>…
exception1
  • 1,239
  • 8
  • 17
1
vote
1 answer

File not found in Docker Container using GitLab-CI

Using GitLab-CI, I am attempting to echo a secret variable into a file inside a Docker container. The file exists and the user has permissions to write to the file yet I get a No such file or directory error. $ /usr/bin/docker exec -t…
Ben Pingilley
  • 729
  • 1
  • 6
  • 13
1
vote
1 answer

Parsing variables in curl with bash script

Hey I am using conduit curl method to create tasks from post. It work fine when I run from terminal with hardcoded values. But when I try to execute it with variables it throws an error: Script: #!/bin/bash echo "$1" echo "$2" echo "$3" echo…
Ahsan Naseem
  • 1,046
  • 1
  • 19
  • 38
1
vote
2 answers

PHP Function return use, not echo, storing as a variable.

My database has a start timestamp and an end timestamp. Although I've not yet had much experience with functions, I've created a function which basically outputs a duration in hours and minutes, that is, the difference between the start and end. It…
morgyface
  • 368
  • 1
  • 9
1
vote
2 answers

Printing the word echo in the output of cat file

I am trying to generate a file using cat in bash where inside the bash, i already ran a script, that i saved into a variable then will be used inside the cat. To ran the script and save the output to a variable, I used the following: declare…
Anis
  • 17
  • 1
  • 4
1
vote
1 answer

Echoing an echo argument in Bash

Here is the code that shows the problem: #!/bin/bash function char() { local char="$(echo $1 | cut -c2)" # Gets second character from argument. echo $char } char -a # Outputs 'a'. char -e …
MOPO3OB
  • 383
  • 3
  • 16