All Questions
8
questions
14
votes
2
answers
8k
views
Quoted vs unquoted string expansion
for i in $(xrandr); do echo "$i" ; done
for i in "$(xrandr)"; do echo "$i"; done
for i in "$(xrandr)"; do echo $i; done
I understand why 1 differs from 2. But why does 3 give a different output from ...
33
votes
5
answers
145k
views
Why is echo ignoring my quote characters?
The echo command isn't including the complete text that I give it. For example, if I do:
$ echo ' echo PARAM=` grep $ARG /var/tmp/setfile | awk '{print $2}' ` '
It outputs:
echo PARAM=` ...
15
votes
6
answers
9k
views
Why there is such a difference in execution time of echo and cat?
Answering this question caused me to ask another question:
I thought the following scripts do the same thing and the second one should be much faster, because the first one uses cat that needs to open ...
2
votes
2
answers
1k
views
Why does the command echo `echo \\\z` output \z?
The command echo $(echo \\\z) is from the book
, I don’t understand why it outputs
\z
I think it should output
z
81
votes
4
answers
205k
views
echo bytes to a file
I'm trying to connect my rasberry Pi to some display using the i2c bus.
To get started I wanted to manually write stuff, bytes in particular to a file.
How do you write specific bytes to a file?
I ...
13
votes
2
answers
3k
views
What is the difference between single quoted $'string' and double quoted $"string" in bash?
I was trying to execute new line using echo and tried following two commands:
First command:
echo $'Hello World\nThis is a new line'
Response:
Hello World
This is a new line
Second command:
echo ...
7
votes
2
answers
887
views
Why does dash's echo expand \\\\ differently to bash's echo?
I have a little open source project that for various reasons I've tried to write in reasonably portable shell script. Its automated integration tests check that hostile characters in path expressions ...
5
votes
3
answers
17k
views
Echo new line and string beginning \t
Sure, echo -e can be used so that \n is understood as a new line. The problem is when I want to echo something beginning with \t e.g. "\test".
So let's say I want to perform echo -e "test\n\\test". I ...