echo is a common command to print a message onto an output device, like a display
Questions tagged [echo]
118 questions
84
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
- 949
41
votes
4 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 "CREATE…
Putnik
- 975
38
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: $ _ <after typing 'foobar':> $ foobar_ But in this case, I don't see what I've typed. I…
congusbongus
- 1,015
37
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
- 1,045
37
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
- 84,333
36
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 now,…
daviesgeek
- 1,709
23
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 we…
Pallav Bakshi
- 371
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!" \ Hello!…
Mohammed Noureldin
- 1,375
20
votes
3 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
- 28,940
20
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
- 1,073
20
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
- 1,457
17
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
- 281
17
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 file2.txt have…
Pierre
- 317
13
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
- 18,575
10
votes
4 answers
SSH: How to change value in config file in one command
How can I change the value of, let's say, PasswordAuthentication in /etc/ssh/sshd_config in commands? As well, remove a # in front of the "key" I wish to value. These don't all have to be in one command. I setup quite a few servers, and remembering…
Brian
- 505