Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [echo]

It is a built-in command typically used in shell scripts to output status text to the screen or a file.

Filter by
Sorted by
Tagged with
6
votes
1answer
112 views

How to print variable value in next line using echo command

I'm getting a curl command output as below curl -s https://api.github.com/repos/harshavardhanc/dockerfile-ansible/pulls\?state\=all | jq -r '.[]|(.number|tostring)+" "+.user.login+" "+.created_at+" "...
20
votes
1answer
878 views

Why don't “echo -e” commands seem to produce the right output?

In the terminal of Ubuntu 18.04 LTS, when I write this command: echo -e "Hello\\\n" It gives this as the output: Hello\n But it should print, as the man page says: Hello\ That is, first print ...
1
vote
2answers
52 views

How to echo commands to other file

I want to make echo from one script to another script, but I don't want to get the output of the command because I want to use this command in another script, I need to create a script that creates ...
0
votes
1answer
39 views

how to display number of lines in running shell file

For my assignment i need to display the current number of lines inside of a shell file, below i have implemented the wc -l command inside of my program but instead of displaying the number of lines my ...
0
votes
1answer
83 views

File's order got destroyed while grepping and echoing into for loop

I want to write the result of grep inside for loop into a file, keeping original file structure. Original file: $cat newtest1 some_text /homes/myself/joz ivan petrov - 20/10/19 new customer: /homes/...
0
votes
2answers
51 views

What !! means while calling echo [duplicate]

Could somebody explain this output? $ echo ! ! $ echo !! echo echo ! echo ! $ I expected sedond echo to write only !!
0
votes
0answers
170 views

Serial port is slow

I've a cash drawer attached to my system via RJ11 cable in /dev/ttyS4. I'm trying to send an echo command to trigger the cash drawer using: echo -e "\x07" > /dev/ttyS4 I observed that the ...
0
votes
3answers
1k views

curl, sh, what do those commands mean?

I've been wandering in the web and saw this about how to install atom, the new text editor: $ curl -sL https://packagecloud.io/AtomEditor/atom/gpgkey | sudo apt-key add - $ sudo sh -c 'echo "deb [...
0
votes
0answers
198 views

Avoid trailing whitespace when copy/pasting from bash/byobu terminal

I wrote a bash script that computes information and echoes it into my byobu terminal. I then select the whole thing with my mouse and paste it into a Gmail conversation after editing it a bit. ...
0
votes
1answer
62 views

Every terminal I open starts with this code, how can I stop this?

every time I open up a terminal it starts with this. export PATH="/home/name/.rbenv/shims:${PATH}" export RBENV_SHELL=bash source '/home/name/.rbenv/libexec/../completions/rbenv.bash' command rbenv ...
6
votes
1answer
754 views

Why there is a difference between the output of 'echo $VAR | wc -c' and 'echo ${#VAR}'?

I'm working on a Bash script and the length of the string contained in a certain variable is one of my conditions. The current string is W5u7TBTzF17GGFV8DBJHvgAAAAI. Initially I've count the string ...
1
vote
1answer
40 views

How do commands fill up the screen?

Some commands, like curl if you do the -# option, fill up the entire screen, even if you resize. How is this done?
4
votes
1answer
82 views

echo command variations

Worked for years but now at least \begin and \end are handled especially. The change in echo behaviour must be new. Even if echo is not portable and the dash echo doesnt support -e / -E options ...
0
votes
1answer
298 views

Escape command in echo

I have some really long and complex command containing both types of quotes: " and ', for example like: cd folder && command --hel="p_me:'please' anyone:'here?'" ; command2 --end='my:"trouble"...
1
vote
0answers
125 views

I want to enable mic echo-cancellation in Ubuntu Mate, but it doesn't work. Please, help!

Please help! I want to enable echo-cancellation in Ubuntu Mate. I watched Yt tutorials and answers on this forum. For solutions like this: Edit /etc/pulse/default.pa and add the following lines to the ...
0
votes
1answer
40 views

Executing echo Command Using Launcher Icon [duplicate]

I am controlling the fan speed on my notebook using acpi and the command: echo level n > /proc/acpi/ibm/fan where level n is a number between 1 and 7. It works, and after I changed the ...
3
votes
1answer
9k views

Alexa for Ubuntu

I received an amazon Echo device as a gift. It included instructions for activating and installing Alexa, but only for Windoze and MAC. A query to the amazon help line returned a brief reply that ...
26
votes
8answers
16k views

How to print text in the terminal as if it's being typed?

I have a simple echo print out that I've added to my .bashrc: echo "$(tput setaf 2)Wake up....." sleep 2s reset sleep 2s echo "$(tput setaf 2)Wake up....." sleep 2s reset echo "$(tput setaf 2)Wake up ...
4
votes
1answer
1k views

Disable volume auto adjust in pulseaudio “module-echo-cancel”

Important: this question How to disable microphone from auto adjusting its input volume doesn't cover this scenario. This question is about the volume auto adjust feature of pulseaudio "module-echo-...
-2
votes
4answers
274 views

Split echo's output on two lines

It is written in the manual that /n will split the output of echo command to the next line. I tried: echo -e 'hello /n world' hello /n world Expecting 'world' on the next line. I failed.
0
votes
1answer
60 views

I am quite unsure of how echo command works in the following two scenarios [duplicate]

I have tried fiddling with echo command to to add $_GET to a text file but looks like it does not work but escaping it with \ works may be because $ is special character in bash. For example, echo "\...
0
votes
0answers
97 views

Echo and Cat output problem

I'm trying to run this script: #!/bin/bash for file in /home/dima/Downloads/dir/* do if [ -f "$file" ] then echo "SSS::################====================#####################" >> ...
0
votes
1answer
224 views

echo “eval `dircolors ${dircolorsdb}`” >> ~/.zshrc didn't work as I expected

I want to insert eval `dircolors $HOME/.dir_colors/dircolors.256dark` in my ~/.zshrc I assigned a variable: dircolorsdb=$HOME/.dir_colors/dircolors.256dark I expect double quotes to result in ...
0
votes
1answer
24k views

What does the echo command do? [duplicate]

I am fairly new to Linux and all I know for sure about the command echo is that when you type a word after it, such as echo Linux!, it prints out Linux!. Is there anything else echo does? I don't ...
1
vote
1answer
1k views

Error using sudo -stdin

I'm trying to use the -S stdin arg on sudo. I tried this: echo 'mypass' | sudo -S cat /etc/shadow And echo 'mypass\n' | sudo -S cat /etc/shadow As the man pages suggest to add a newline. Both ...
3
votes
1answer
157 views

Error while trying to post $PS1 on my terminal

I have tried to echo $PS1 on my terminal to find out the [u@h W] this is the error I get. echo $PS1 %{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%X]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $...
11
votes
4answers
16k views

Appending a line to a file in the cat command?

I can do cat file.txt to get the contents of a file but I also want to tack on a final line of my own choosing. I tried piping (cat file.txt ; echo "My final line") | but only the final line is ...
4
votes
3answers
843 views

Is there a better way to create a file in bash other than using touch and echo?

I created a bash script that installed some applications and wrote a .conf file. I wanted my bash script to create the file for me so I could just run the file and it set it all up. was there a better ...
52
votes
2answers
10k views

Why is there a /bin/echo and why would I want to use it?

I noticed that there is a binary executable /bin/echo on my Ubuntu MATE 17.04 system. I thought, that's odd, because $ type echo echo is a shell builtin Cursory testing suggests that /bin/echo does ...
1
vote
1answer
2k views

Changing text color in-line?

Short question: Using bash, is it possible to print a sentence such that each individual word has a different color? I.e; print a word in-line, change the text color, repeat?
0
votes
1answer
244 views

How to print parent working directory

How can I list everything in the parent directory without having to cd there. Can this be done with echo? In othere words instead of having to do this: cd .. && ls | grep somefile && ...
4
votes
1answer
674 views

Amazon Echo “Alexa” now only shows up as an input device

So, I've been using my Amazon Echo (the big tower, not the little "dot") as a bluetooth speaker with my Ubuntu laptop without any trouble. BUT a few days ago it started showing up only as an input ...
6
votes
3answers
4k views

Why does echo $$ return a number?

Why does running echo $$ in bash return a number like 7190, while running echo $ only returns a $?
14
votes
2answers
4k views

Using “while read…”,echo and printf get different outcomes

According to this question "Using "while read..." in a linux script" echo '1 2 3 4 5 6' | while read a b c;do echo "$a, $b, $c"; done outcome: 1, 2, 3 4 5 6 but when I replace echo with printf ...
0
votes
1answer
953 views

Bash Script Will not Print out to Console

How do I get a bash script to print out to my putty console when run. I thought I am supposed to use Echo but My script below only gives me a blank terminal when executed yet still works as planned? #...
2
votes
1answer
6k views

bash: echo: write error: Invalid argument

I am trying to setup a USB dongle on my device by following the post here. I wasn't successful in setting it up and while tracing my steps discovered that echo "1c9e:9ba1" > /sys/bus/usb-serial/...
0
votes
1answer
118 views

Script Doesn't Work In rc.local

I have a shell script that is supposed to send me a message with this command: echo 'The user "Janet" has logged in' | write gilbert pts/0 If I run it, it does print the string. But if I put it in ...
4
votes
1answer
589 views

How can you printf or echo the contents of your clipboard? [duplicate]

Alternatively, how can you dump the contents of your clipboard to a text file? If at all possible, I'd like this for the actual clipboard, but also the clipboard delegated to highlighted text, and ...
1
vote
0answers
27 views

How do I overcome “permission denied” when using sudo? [duplicate]

I’m using Ubuntu 14.04. I’m having trouble clearing out a file. I’m getting permission denied even though I’m using sudo. Here’s what’s happening … myuser@mymachine:~$ sudo chmod 755 /var/log/...
3
votes
1answer
6k views

Echo Cancellation and Noise Reduction for Ubuntu 16.04 LTS? [duplicate]

I have been using Ubuntu 16.04 LTS on my ASUS TP200SA for a week now and after making a Skype call I have realized that the features that had with Windows are gone now. My laptop has a stereo ...
1
vote
1answer
39 views

how to change part of a file name to something else on mutilple files

I'm making a game to help learn commands and I have directories that will all have the same number of files of different types in them. I need to be able to change part of the file name in each ...
0
votes
1answer
165 views

Using the command 'echo' how can I write a large amount of text and see the result?

I have entered the command 'echo' then typed a large amount of text afterwards. After pressing enter an arrow appeared. How do I see the text that I have typed out?
0
votes
1answer
461 views

How to echo “some text” and result of function in one line?

I'm starting to learn Bash scripting. And I had a question. The code below is working fine, Echo "Here is your current directory: " pwd but what if I want to have the result of pwd to be written in ...
1
vote
2answers
3k views

copy text from file to another

I've been trying to copy the entire text of a file to another The command that I've been using is: echo $(cat file1) > file2 file1 text text in other line more text in other line But my result ...
3
votes
1answer
1k views

echo #? is not printing any kind of value

When I enter some command in terminal and check whether that command worked or not by typing echo #? it is not printing any kind of integer value? Is there any problem with my system? I am using ...
-2
votes
2answers
63 views

How to write a file for a program's file argument in one line

I have a program that can accept, as an argument, a file full of commands and run them: $ <program> <filename> This is what I have working so far: $ cat <filename> <command> ...
10
votes
1answer
1k views

'top' shows 'echo “find”' processes using 100% CPU time

I have an Ubuntu 14.04 server, and found that some processes are running with root privileges and takes all my processor time. The processes are called 'echo "find"'. What are these, and how can I ...
3
votes
2answers
3k views

Prompt overwrite file in echo

I am writing to a file using simple echo (I'm open to using other methods). When writing to a file that already exists, can I make echo prompt the user to overwrite or not? For eg, maybe an argument ...
2
votes
1answer
144 views

echo create command, what's it doing?

I've been trying to figure out what this line does for a few hours. I have to automate the step using ansible and can't find anything on the create command. Any help is appreciated. echo -e "create /...
2
votes
1answer
4k views

ECHO behaviour with and without double quotes with hex

Can someone help me to understand behaviour of echo? I am trying the following commands in Ubuntu: $ echo -e \xaa xaa $ echo -e "\xaa" ▒ $ As you can see, with double quotes, while printing ...