echo is a common command to print a message onto an output device, like a display
Questions tagged [echo]
110 questions
42
votes
2 answers
Path Environment Variable Windows 10. Echo %Path% on command prompt shows only %Path%
My variable value in path is as follows
C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program…
Arun S
- 529
- 1
- 4
- 3
37
votes
3 answers
equivalent "echo on" for linux?
How can I get to stdout all commands that run in bash script?
That is output must contain commands output AND commands themselves.
I found
#!/bin/bash -x
but this is not exactly the same because instead of
mysql -v dbname < dump.sql | grep…
Putnik
- 811
- 1
- 6
- 14
35
votes
2 answers
What is wrong with “echo $(stuff)” or “echo `stuff`”?
I used one of the following
echo $(stuff)
echo `stuff`
(where stuff is e.g. pwd or date or something more complicated).
Then I was told this syntax is wrong, bad practice, non-elegant, excessive, redundant, overly complicated, cargo cult…
Kamil Maciorowski
- 56,974
- 22
- 100
- 154
29
votes
2 answers
Shell script echo new line to file
I want to echo a new line to a file in between variables in a shell script. Here's my code:
var1="Hello"
var2="World!"
logwrite="$var1 [Here's where I want to insert a new line] $var2
echo "$logwrite" >> /Users/username/Desktop/user.txt
Right…
daviesgeek
- 1,559
- 7
- 20
- 34
29
votes
1 answer
how to escape pipe symbol | in bat scripts?
I need to echo commad usage like this in batch script named command.bat
command.bat on|off
I cant use
echo %0 on|off
I know I can use
echo "%0 on|off"
but it puts quotes along
Is there any other way?
Prashant Bhate
- 895
- 2
- 9
- 12
25
votes
2 answers
Why use echo before installing new software?
I am new to the computing world. While installing ROS Indigo, the first step directs me to use the following code:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
Why do…
Pallav Bakshi
- 371
- 3
- 9
22
votes
1 answer
Why does `echo -e "\\\SOME_TEXT"` show only one backslash?
Could some one explain what is happening behind the scenes in character escaping in Linux shell? I tried the following and googled a lot, without any success in understanding what (and how) is going on:
root@sv01:~# echo -e "\ Hello!"
\…
Mohammed Noureldin
- 1,245
- 2
- 19
- 29
21
votes
2 answers
How do I restore input echoing in the terminal?
Sometimes when a script gets killed at a password prompt, I can no longer see my input being echoed in the terminal. That is, normally at a terminal, I see this:
$ _
$ foobar_
But in this case, I don't see what I've…
congusbongus
- 615
- 1
- 6
- 13
17
votes
3 answers
How to print new line character with echo?
I dump a string with hexdump like this 2031 3334 2e30 0a32 2032 3331 302e 000a. It is clear that 0x0a is new line character, however, when I try to echo this string out, I always got 1 430.2 2 13.0 -- the new line is replaced with a space, even I…
Summer_More_More_Tea
- 953
- 6
- 13
- 28
16
votes
3 answers
Change encoding of txt file
When I write :
file file1.txt
I have this output : Little-endian UTF-16 Unicode text, with CR line terminators
Then if I write :
file file2.txt
I have : ASCII text
file2.txt is created by making :
echo $var > "file2.txt"
I would like…
Pierre
- 297
- 2
- 3
- 7
16
votes
4 answers
How do I create a multiline text file with Echo in Windows command prompt?
I'm using Windows 7 and I would like to quickly create a small text file with a few lines of text in the Command prompt.
I can create a single line text file with:
echo hello > myfile.txt
but how can I create a text file with multiple lines using…
Jonas
- 24,625
- 46
- 103
- 123
16
votes
7 answers
Cat command and echo
I'd like to concatenate the output from echo with content of a file. I've tried the following comand:
echo "abc" | cat 1.txt > 2.txt
but the 2.txt file only contains the content from 1.txt. Why doesn't it work?
Ringger81
- 907
- 3
- 8
- 19
15
votes
3 answers
Why does bash need && to echo a variable on one line?
Why does SOMETHING=1 && echo $SOMETHING need && to return 1
Why doesn't SOMETHING=1 echo $SOMETHING return 1
Joel
- 261
- 2
- 6
12
votes
3 answers
On a Linux shell, what is echo $1 supposed to do?
I do a echo $1, it prints out what is the default login shell used.
But for echo $2 onwards, all I get is a newline. Why is that?
Lazer
- 16,077
- 39
- 110
- 139
8
votes
2 answers
A Unix shell command alternative to echo
I'm trying to output string literals to a file. So far I've been trying to use the echo command, but unfortunately I've discovered it's impossible to output '-n', '-e' or '-E' (at least not without much complicating the code). Is there any…
Moon Soon
- 83
- 1
- 1
- 3