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
2 answers

I am trying to echo an expect script into a file but no success

I am trying to echo an expect script into a file so I can execute it on the fly. Here is what I have so far: #!/bin/bash echo '#!/usr/bin/expect -f' > expect_file echo 'expect "\[RETURN\]" {send "\r"}' >> expect_file that will yield me a file with…
Vituvo
  • 1,008
  • 1
  • 9
  • 29
1
vote
4 answers

Rounding down divided numbers with php

Below is the code I am using within a while loop to display a number within a table row and it's amount divided by 200 right next to it ('amount'). It works ok in that it takes off the decimals and divides by 200 but I was wondering how do I round…
AdamMc
  • 205
  • 2
  • 7
  • 24
1
vote
3 answers

How to echo variable without losing space in a for loop?

$ cat testfile first line mark apple second line not banana third line mark pear I want to for loop each line of the file. If it contains mark then show the whole line without losing space. but if my code as below, it turns the space into…
1
vote
0 answers

Echo won't print to serial without cat observing it

I've been trying to send commands to an ESP8266 using the terminal on OSX. I've been able to open the nodemcu interface using screen and send commands successfully, but when I try and send commands via echo (turning the on board LED on): echo…
J Field
  • 21
  • 1
1
vote
1 answer

PHP: Match text respectively with querystring

I have the following line: Mt 5: 2 And I use jquery code to echo (match) whatever between the > < brackets and makes the link as follows: Mt 5: 2 Now I need the link to be as follows:
Mike
  • 2,051
  • 4
  • 28
  • 46
1
vote
1 answer

PHP Get user local machine name on wireless network

I am trying to get the users machine name by using gethostbyaddr($_SERVER['REMOTE_ADDR']); but all I get is the host name which is the same for all users in my wireless network. I googled and some say it is not possible to get the users local…
omerdoron
  • 25
  • 7
1
vote
2 answers

BATCH input redirection operator

set a=file if exist "folder\%a%" ( set /p x= < "folder\%a%" echo %x% ) i've been writing batch files for a long time, but i don't get it why this code does not work. Im expecting the code to echo out the content of the %a%. but all it returns…
kapitanluffy
  • 1,269
  • 7
  • 26
  • 54
1
vote
1 answer

.Bat/CMD - Hiding "ERROR" if the key was not found

This is my code: @echo off echo Checking 32bit registry. REG QUERY "HKLM\Software\EA GAMES\NFSMW" /v InstallDir >nul If %ERRORLEVEL% == 0 goto CHECKEND If %ERRORLEVEL% == 1 goto CHECK64 :CHECK64 echo Checking 64bit registry. REG…
Damian Silent
  • 215
  • 3
  • 13
1
vote
0 answers

echo flag -n is printing out when run from script

When I run the following command from the terminal: echo -n hello >> output.txt It appends 'hello' to the file and doesn't add a trailing newline, which is what I want it to do. However, if I have a file named prog.sh with that exact same line as…
Henry Brice
  • 280
  • 1
  • 2
  • 18
1
vote
1 answer

Amazon Echo Show's background image will not scale

I am trying to build a skill for the Amazon Echo Show in Python3 to quiz users on U.S. states. In order to do this, I would like to display an image on the Show's screen. However, when I try to do this, my image gets chopped off. I try to scale the…
peachykeen
  • 4,143
  • 4
  • 30
  • 49
1
vote
1 answer

Whats the meaning of "-" (minus) in PHPs ASP style tags

Uhh, turns out I was asking the wrong question. The tag were not PHP but rather JavaScript templating ones. Thanks again for answering to all, it were good leads to getting to the bottom of this. I am trying to understand how some legacy PHP Code…
staeff
  • 31
  • 1
  • 6
1
vote
1 answer

How to create function for special colored echo?

To print colored words, I could do this in shell: declare -A COLORS COLORS["red"]='\033[0;31m' COLORS["default"]='\033[0m' echo -e "${COLORS["red"]}abc${COLORS["default"]}" # With color echo -e "xyz" # No color. echo -e…
alvas
  • 115,346
  • 109
  • 446
  • 738
1
vote
1 answer

How to get echo to print only deleted file paths?

I'm trying to write a script to create mysqldumps daily in a directory as well as check all the backups in that directory and remove any older than 7 days that is going to run on cron. So my functions work correctly, it's just my last echo command…
d.r.v.
  • 117
  • 1
  • 1
  • 8
1
vote
1 answer

Python echo output constantly searches but never ends

For our assignment, when we run our little bot, it gets stuck in an endless loop and we can't get it to end. All it does is constantly look for new bots i.e: Waiting for connection... Enter command: p2p echo Finding another bot... Found bot on port…
arafes
  • 11
  • 1
1
vote
0 answers

Issues with displaying image product from the woocommerce cart

I am trying to display the thumbnail from a product that a customer would had in its cart on my website. Here is my code : function fictive_cart() { global $woocommerce; $items = $woocommerce->cart->get_cart(); $nb_article =…
AntoineKB
  • 11
  • 2