What !! means while calling echo
Could somebody explain this output?
$ echo !
!
$ echo !!
echo echo !
echo !
$
I expected sedond echo to write only !!
command-line echo
add a comment |
Could somebody explain this output?
$ echo !
!
$ echo !!
echo echo !
echo !
$
I expected sedond echo to write only !!
command-line echo
If you view your commandhistory
& decide you want to run command 419 in that history, you can type!419
and it'll execute. Provided answers tell you!!
executes your last command, but it has other uses too :)
– guiverc
4 hours ago
Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate
– Sergiy Kolodyazhnyy
3 hours ago
To prevent the!!
from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, egecho '!!'
gnu.org/software/bash/manual/html_node/Quoting.html
– michael
3 hours ago
add a comment |
Could somebody explain this output?
$ echo !
!
$ echo !!
echo echo !
echo !
$
I expected sedond echo to write only !!
command-line echo
Could somebody explain this output?
$ echo !
!
$ echo !!
echo echo !
echo !
$
I expected sedond echo to write only !!
command-line echo
command-line echo
asked 4 hours ago
SanyaSanya
12
12
If you view your commandhistory
& decide you want to run command 419 in that history, you can type!419
and it'll execute. Provided answers tell you!!
executes your last command, but it has other uses too :)
– guiverc
4 hours ago
Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate
– Sergiy Kolodyazhnyy
3 hours ago
To prevent the!!
from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, egecho '!!'
gnu.org/software/bash/manual/html_node/Quoting.html
– michael
3 hours ago
add a comment |
If you view your commandhistory
& decide you want to run command 419 in that history, you can type!419
and it'll execute. Provided answers tell you!!
executes your last command, but it has other uses too :)
– guiverc
4 hours ago
Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate
– Sergiy Kolodyazhnyy
3 hours ago
To prevent the!!
from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, egecho '!!'
gnu.org/software/bash/manual/html_node/Quoting.html
– michael
3 hours ago
If you view your command
history
& decide you want to run command 419 in that history, you can type !419
and it'll execute. Provided answers tell you !!
executes your last command, but it has other uses too :)– guiverc
4 hours ago
If you view your command
history
& decide you want to run command 419 in that history, you can type !419
and it'll execute. Provided answers tell you !!
executes your last command, but it has other uses too :)– guiverc
4 hours ago
Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate
– Sergiy Kolodyazhnyy
3 hours ago
Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate
– Sergiy Kolodyazhnyy
3 hours ago
To prevent the
!!
from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, eg echo '!!'
gnu.org/software/bash/manual/html_node/Quoting.html– michael
3 hours ago
To prevent the
!!
from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, eg echo '!!'
gnu.org/software/bash/manual/html_node/Quoting.html– michael
3 hours ago
add a comment |
2 Answers
2
active
oldest
votes
!!
means last command.
echo !!
will echo last command, which was echo !
.
add a comment |
Easily explained:
$ echo 1
1
$ !!
echo 1
1
so !!
just repeats the last command, so
echo !!
does excactly what it's supposed to to!
;-)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1119353%2fwhat-means-while-calling-echo%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
!!
means last command.
echo !!
will echo last command, which was echo !
.
add a comment |
!!
means last command.
echo !!
will echo last command, which was echo !
.
add a comment |
!!
means last command.
echo !!
will echo last command, which was echo !
.
!!
means last command.
echo !!
will echo last command, which was echo !
.
answered 4 hours ago
Manoj SawaiManoj Sawai
6641720
6641720
add a comment |
add a comment |
Easily explained:
$ echo 1
1
$ !!
echo 1
1
so !!
just repeats the last command, so
echo !!
does excactly what it's supposed to to!
;-)
add a comment |
Easily explained:
$ echo 1
1
$ !!
echo 1
1
so !!
just repeats the last command, so
echo !!
does excactly what it's supposed to to!
;-)
add a comment |
Easily explained:
$ echo 1
1
$ !!
echo 1
1
so !!
just repeats the last command, so
echo !!
does excactly what it's supposed to to!
;-)
Easily explained:
$ echo 1
1
$ !!
echo 1
1
so !!
just repeats the last command, so
echo !!
does excactly what it's supposed to to!
;-)
edited 3 hours ago
wjandrea
9,22442463
9,22442463
answered 4 hours ago
FabbyFabby
26.8k1360161
26.8k1360161
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1119353%2fwhat-means-while-calling-echo%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you view your command
history
& decide you want to run command 419 in that history, you can type!419
and it'll execute. Provided answers tell you!!
executes your last command, but it has other uses too :)– guiverc
4 hours ago
Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate
– Sergiy Kolodyazhnyy
3 hours ago
To prevent the
!!
from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, egecho '!!'
gnu.org/software/bash/manual/html_node/Quoting.html– michael
3 hours ago