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
41
votes
6 answers

Can I use ECHO to execute commands?

I've come up with a cool script that will produce the output that I need, but it only displays on the screen, so I have to copy, then paste in the commands to get them to execute. Here's the abbreviated version of my…
jols
  • 509
  • 1
  • 4
  • 5
39
votes
6 answers

How do I write non-ASCII characters using echo?

How do I write non-ASCII characters using echo? Is there an escape sequence, such as \012 or something like that? I want to append ASCII characters to a file using: echo ?? >> file
flybywire
  • 261,858
  • 191
  • 397
  • 503
37
votes
8 answers

PHP: How do I display the contents of a textfile on my page?

I have a .txt file on my web server (locally) and wish to display the contents within a page (stored on the same server) via PHP echo. The .txt file contains a number that is updated by another script on another page, but for this page I just want…
Phil
  • 373
  • 1
  • 3
  • 6
36
votes
3 answers

When I start my terminal I get "login: /usr/local/bin/bash: No such file or directory [Process completed]" and i cant type anything in my terminal

These are the series of commands I entered that cause the problem. brew install bash echo '/usr/local/bin/bash' | sudo tee -a /etc/shells chsh -s /usr/local/bin/bash Now when I start my terminal, I get this. Last login: Sun Apr 7 14:40:48 on…
Yvan Niyonzima
  • 461
  • 1
  • 4
  • 3
36
votes
11 answers

echo key and value of an array without and with loop

This is an array i have How do i get to echo something like this for individual one like Home is at index.html and again how can i do this through a loop and echo all?
esafwan
  • 17,311
  • 33
  • 107
  • 166
34
votes
3 answers

Echoing a backspace

Is it possible to echo a backspace in bash? Something like echo $'stack\b' Shouldn't output stac? Or I'm missing something? More specifically, I'd like to use that in: ls | wc -l; echo $'\b items'
sidyll
  • 57,726
  • 14
  • 108
  • 151
33
votes
3 answers

Makefile `echo -n' not working

I am trying to have my Makefile echo text without the trailing new line, but am unable to. I am experiencing the behavior on OS X (on Linux everything works as expected). Makefile a: @echo -n "hello" b: @echo -n hello c: @/bin/echo -n…
Chris
  • 2,786
  • 1
  • 28
  • 31
32
votes
4 answers

echo outputs -e parameter in bash scripts. How can I prevent this?

I've read the man pages on echo, and it tells me that the -e parameter will allow an escaped character, such as an escaped n for newline, to have its special meaning. When I type the command $ echo -e 'foo\nbar' into an interactive bash shell, I…
31
votes
9 answers

Simple PHP echo code not working

Here is my html with a php script: Bob's Auto Parts

Bob's Auto Parts

This is…
edorahg
  • 399
  • 1
  • 4
  • 11
31
votes
4 answers

PHP Print keys from an object?

I have an object BIRD and then there is [0] through [10] and each number has a subheading like "bug" or "beetle" or "gnat" and a value for each of those. I want to print BIRD [0] bug = > value I can't find out how to do this anywhere…
user723220
  • 817
  • 3
  • 12
  • 20
29
votes
8 answers

Add PHP variable inside echo statement as href link address?

I'm trying to use a PHP variable to add a href value for a link in an echo statement. Here's a simplified version of the code I want to use. I know that I can't just add the variable into the echo statement, but I can't seem to find an example…
jasonbradberry
  • 853
  • 2
  • 17
  • 30
29
votes
4 answers

echo multiple lines into a file

I have a httpd.conf file of shared hosting server and I have a task to migrate every virtual host to a vps. using awk I extract a block of virtual host entry for a particular site. and store that entry in a variable. but when i echo the out put of…
aditya
  • 531
  • 2
  • 5
  • 14
28
votes
1 answer

ftrace: system crash when changing current_tracer from function_graph via echo

I have been playing with ftrace recently to monitor some behavior characteristics of my system. I've been handling switching the trace on/off via a small script. After running the script, my system would crash and reboot itself. Initially, I…
buratino
  • 1,408
  • 2
  • 17
  • 40
28
votes
3 answers

print double quotes in shell programming

I want to print double quotes using echo statement in shell programming. Example: echo "$1,$2,$3,$4"; prints xyz,123,abc,pqrs How to print "xyz","123","abc","pqrs"; I had tried to place double quotes in echo statement but its not being printed.
Nagaraju
  • 1,853
  • 2
  • 27
  • 46
27
votes
1 answer

How do I print the result of a command with 'echo'?

How do print my full name with the following? awk -F: '($1==U){print $5}' U=$LOGNAME /etc/passwd Per example, but with the echo command with some words on sides: For example, Hello Diogo Saraiva, happy to see you again Where Diogo Saraiva is my…
DiogoSaraiva
  • 1,515
  • 2
  • 15
  • 19