cd ` command meaning and how to exit it?Terminal shows > after entering What mode does the terminal go into when I type a single quote?Unable to enter new commands in terminal — stuck with “>”Using grep with pipe and ampersand to filter errors from findConfigure bash to print exit status of every command enteredHow to remove PATH variable on Ubuntu 14.04?Exit from both root and user with one commandhelp needed understaning ls format meaningHow exit from tty4 terminal without using Alt+SysRq+B to exit?Exit terminal after dd command complete“XXX is hashed” meaning from type command?How does the history command work?Open XFCE Terminal Window and Run command in same Window

Is this state of Earth possible, after humans left for a million years?

How to select certain lines (n, n+4, n+8, n+12...) from the file?

Is ‘despite that’ right?

Renting a house to a graduate student in my department

Can more than one creature benefit from multiple Hunter's Mark spells cast on the same target?

What does formal training in a field mean?

What was the notion of limit that Newton used?

What do "KAL." and "A.S." stand for in this inscription?

Why does the Earth follow an elliptical trajectory rather than a parabolic one?

Can the president of the United States be guilty of insider trading?

What can cause an unfrozen indoor copper drain pipe to crack?

Passport stamps art, can it be done?

When quoting someone, is it proper to change "gotta" to "got to" without modifying the rest of the quote?

What's the difference between const array and static const array in C/C++

Are there variations of the regular runtimes of the Big-O-Notation?

How to handle DM constantly stealing everything from sleeping characters?

How to make a language evolve quickly?

If a character drops a magic item that turns on/off, does that item turn off when they drop it?

Is a vertical stabiliser needed for straight line flight in a glider?

Remove color cast in darktable?

What was the plan for an abort of the Enola Gay's mission to drop the atomic bomb?

Pre-1993 comic in which Wolverine's claws were turned to rubber?

Why do protein solutions have to be alkalised in biuret test?

We are two immediate neighbors who forged our own powers to form concatenated relationship. Who are we?



cd ` command meaning and how to exit it?


Terminal shows > after entering What mode does the terminal go into when I type a single quote?Unable to enter new commands in terminal — stuck with “>”Using grep with pipe and ampersand to filter errors from findConfigure bash to print exit status of every command enteredHow to remove PATH variable on Ubuntu 14.04?Exit from both root and user with one commandhelp needed understaning ls format meaningHow exit from tty4 terminal without using Alt+SysRq+B to exit?Exit terminal after dd command complete“XXX is hashed” meaning from type command?How does the history command work?Open XFCE Terminal Window and Run command in same Window






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















when I type



$ cd `


into a terminal, then I get this



>


even ls or cd is not working, please explain the meaning of the above command and how do I exit it?










share|improve this question









New contributor



Vaishnava Hari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 2





    Ctrl+C or another `. All quotes must be terminated properly. See en.wikipedia.org/wiki/Command_substitution

    – FedonKadifeli
    May 6 at 20:25












  • As for the meaning, the single backquote, ` , tells the shell that you are starting a command substitution and > means that the shell wants you to complete it.

    – John1024
    May 6 at 20:28












  • Duplicate on Unix & Linux: What is the effect of a lone backtick at the end of a command line?, related: What mode does the terminal go into when I type a single quote?, Terminal shows > after entering backslash

    – wjandrea
    May 6 at 21:08












  • Possible duplicate of Unable to enter new commands in terminal — stuck with “>”

    – wjandrea
    May 6 at 21:10

















0















when I type



$ cd `


into a terminal, then I get this



>


even ls or cd is not working, please explain the meaning of the above command and how do I exit it?










share|improve this question









New contributor



Vaishnava Hari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 2





    Ctrl+C or another `. All quotes must be terminated properly. See en.wikipedia.org/wiki/Command_substitution

    – FedonKadifeli
    May 6 at 20:25












  • As for the meaning, the single backquote, ` , tells the shell that you are starting a command substitution and > means that the shell wants you to complete it.

    – John1024
    May 6 at 20:28












  • Duplicate on Unix & Linux: What is the effect of a lone backtick at the end of a command line?, related: What mode does the terminal go into when I type a single quote?, Terminal shows > after entering backslash

    – wjandrea
    May 6 at 21:08












  • Possible duplicate of Unable to enter new commands in terminal — stuck with “>”

    – wjandrea
    May 6 at 21:10













0












0








0








when I type



$ cd `


into a terminal, then I get this



>


even ls or cd is not working, please explain the meaning of the above command and how do I exit it?










share|improve this question









New contributor



Vaishnava Hari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











when I type



$ cd `


into a terminal, then I get this



>


even ls or cd is not working, please explain the meaning of the above command and how do I exit it?







command-line bash cd-command






share|improve this question









New contributor



Vaishnava Hari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



Vaishnava Hari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited May 7 at 2:36









pomsky

34.4k11108141




34.4k11108141






New contributor



Vaishnava Hari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked May 6 at 20:22









Vaishnava HariVaishnava Hari

62




62




New contributor



Vaishnava Hari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Vaishnava Hari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









  • 2





    Ctrl+C or another `. All quotes must be terminated properly. See en.wikipedia.org/wiki/Command_substitution

    – FedonKadifeli
    May 6 at 20:25












  • As for the meaning, the single backquote, ` , tells the shell that you are starting a command substitution and > means that the shell wants you to complete it.

    – John1024
    May 6 at 20:28












  • Duplicate on Unix & Linux: What is the effect of a lone backtick at the end of a command line?, related: What mode does the terminal go into when I type a single quote?, Terminal shows > after entering backslash

    – wjandrea
    May 6 at 21:08












  • Possible duplicate of Unable to enter new commands in terminal — stuck with “>”

    – wjandrea
    May 6 at 21:10












  • 2





    Ctrl+C or another `. All quotes must be terminated properly. See en.wikipedia.org/wiki/Command_substitution

    – FedonKadifeli
    May 6 at 20:25












  • As for the meaning, the single backquote, ` , tells the shell that you are starting a command substitution and > means that the shell wants you to complete it.

    – John1024
    May 6 at 20:28












  • Duplicate on Unix & Linux: What is the effect of a lone backtick at the end of a command line?, related: What mode does the terminal go into when I type a single quote?, Terminal shows > after entering backslash

    – wjandrea
    May 6 at 21:08












  • Possible duplicate of Unable to enter new commands in terminal — stuck with “>”

    – wjandrea
    May 6 at 21:10







2




2





Ctrl+C or another `. All quotes must be terminated properly. See en.wikipedia.org/wiki/Command_substitution

– FedonKadifeli
May 6 at 20:25






Ctrl+C or another `. All quotes must be terminated properly. See en.wikipedia.org/wiki/Command_substitution

– FedonKadifeli
May 6 at 20:25














As for the meaning, the single backquote, ` , tells the shell that you are starting a command substitution and > means that the shell wants you to complete it.

– John1024
May 6 at 20:28






As for the meaning, the single backquote, ` , tells the shell that you are starting a command substitution and > means that the shell wants you to complete it.

– John1024
May 6 at 20:28














Duplicate on Unix & Linux: What is the effect of a lone backtick at the end of a command line?, related: What mode does the terminal go into when I type a single quote?, Terminal shows > after entering backslash

– wjandrea
May 6 at 21:08






Duplicate on Unix & Linux: What is the effect of a lone backtick at the end of a command line?, related: What mode does the terminal go into when I type a single quote?, Terminal shows > after entering backslash

– wjandrea
May 6 at 21:08














Possible duplicate of Unable to enter new commands in terminal — stuck with “>”

– wjandrea
May 6 at 21:10





Possible duplicate of Unable to enter new commands in terminal — stuck with “>”

– wjandrea
May 6 at 21:10










2 Answers
2






active

oldest

votes


















8














Backticks work in pairs. Bash is waiting for you to provide another backtick to complete the command/expression.



> is simply a prompt for newline which is determined by the value of PS2 generally defined in .bashrc.



Whenever you hit Enter (if the command/expression is incomplete, i.e. backtick isn't closed), bash expects you to complete the command/expression either in one line or multiple lines. For example, you want to evaluate value of 'a' using expr. You can do



$ a=`
> expr 1 + 3`


will be interpreted as



$ a=`expr 1 + 3`


So, if you want to run some command either complete the required expression or if there is no command/expression required in between backticks, refrain from using that. Another way is to use Ctrl+C, but that would be a Keyboard Interrupt and will make your command to terminate immediately.



To read more about backticks, read these questions on U&L: Understanding backtick and What does ` (backquote/backtick) mean in commands?






share|improve this answer

























  • This is a good answer but a=`echo $b` is in most cases a bad example. You will get the value of $b, with all sequences of whitespace replaced with single spaces, then each word will be expanded as a glob based on the files of the current directory, and then all trailing newlines will be trimmed, and a single newline will be added in the end. I'd say that 99.9% of the time you'd want a=$b, and the rest a=$(echo "$b") if you want a single trailing newline.

    – user000001
    May 6 at 20:59












  • Hey @user000001, thank you for your valuable comment. What about a=`expr 1 + 3` example? (Formatting in comments sucks!!!)

    – Kulfy
    May 6 at 21:04







  • 1





    Yes, that's much better, though surely someone will come along and complain that since the question is tagged [bash], you'd be using a=$((b+3)) in real code instead of expr ;)

    – user000001
    May 6 at 21:09







  • 1





    @user000001 Replaced. The question is about ``` ` ``` and >, I don't think such complain would occur ;-).

    – Kulfy
    May 6 at 21:20







  • 1





    Consider the complaint made -- we've got so many people using 1970s-era expr syntax because they're used to seeing it around so they think it's normal/expected/correct, vs standardized-since-the-1990s (and thus not at all a bashism) $(( ... )) POSIX math syntax. date is a lot more defensible as an example, since it's legitimately needed when writing code for POSIX shells (or versions of bash that aren't recent 4.x adding printf '%(...)T') today.

    – Charles Duffy
    May 6 at 21:57



















5














The backticks create an execution environment called command substitution. It is used like this, for example:



echo "The date today is `date`"


Here, the date command is executed first, and its output replaces the part between the backticks, so in the end you get a string with the current date.



Command substitution may span multiple lines, so when you type:



cd `


and press Enter, bash expects you to complete the command substitution, before executing the cd command. This can be broken either by closing the backtick and pressing Enter, or by pressing CTRL-c (This will abort the command without anything getting executed).



Note that modern guidelines prefer to avoid the backtick syntax for command substitution, and to use $( ) instead, so the first example would be:



echo "The date today is $(date)"





share|improve this answer

























    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
    );



    );






    Vaishnava Hari is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1141052%2fcd-command-meaning-and-how-to-exit-it%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









    8














    Backticks work in pairs. Bash is waiting for you to provide another backtick to complete the command/expression.



    > is simply a prompt for newline which is determined by the value of PS2 generally defined in .bashrc.



    Whenever you hit Enter (if the command/expression is incomplete, i.e. backtick isn't closed), bash expects you to complete the command/expression either in one line or multiple lines. For example, you want to evaluate value of 'a' using expr. You can do



    $ a=`
    > expr 1 + 3`


    will be interpreted as



    $ a=`expr 1 + 3`


    So, if you want to run some command either complete the required expression or if there is no command/expression required in between backticks, refrain from using that. Another way is to use Ctrl+C, but that would be a Keyboard Interrupt and will make your command to terminate immediately.



    To read more about backticks, read these questions on U&L: Understanding backtick and What does ` (backquote/backtick) mean in commands?






    share|improve this answer

























    • This is a good answer but a=`echo $b` is in most cases a bad example. You will get the value of $b, with all sequences of whitespace replaced with single spaces, then each word will be expanded as a glob based on the files of the current directory, and then all trailing newlines will be trimmed, and a single newline will be added in the end. I'd say that 99.9% of the time you'd want a=$b, and the rest a=$(echo "$b") if you want a single trailing newline.

      – user000001
      May 6 at 20:59












    • Hey @user000001, thank you for your valuable comment. What about a=`expr 1 + 3` example? (Formatting in comments sucks!!!)

      – Kulfy
      May 6 at 21:04







    • 1





      Yes, that's much better, though surely someone will come along and complain that since the question is tagged [bash], you'd be using a=$((b+3)) in real code instead of expr ;)

      – user000001
      May 6 at 21:09







    • 1





      @user000001 Replaced. The question is about ``` ` ``` and >, I don't think such complain would occur ;-).

      – Kulfy
      May 6 at 21:20







    • 1





      Consider the complaint made -- we've got so many people using 1970s-era expr syntax because they're used to seeing it around so they think it's normal/expected/correct, vs standardized-since-the-1990s (and thus not at all a bashism) $(( ... )) POSIX math syntax. date is a lot more defensible as an example, since it's legitimately needed when writing code for POSIX shells (or versions of bash that aren't recent 4.x adding printf '%(...)T') today.

      – Charles Duffy
      May 6 at 21:57
















    8














    Backticks work in pairs. Bash is waiting for you to provide another backtick to complete the command/expression.



    > is simply a prompt for newline which is determined by the value of PS2 generally defined in .bashrc.



    Whenever you hit Enter (if the command/expression is incomplete, i.e. backtick isn't closed), bash expects you to complete the command/expression either in one line or multiple lines. For example, you want to evaluate value of 'a' using expr. You can do



    $ a=`
    > expr 1 + 3`


    will be interpreted as



    $ a=`expr 1 + 3`


    So, if you want to run some command either complete the required expression or if there is no command/expression required in between backticks, refrain from using that. Another way is to use Ctrl+C, but that would be a Keyboard Interrupt and will make your command to terminate immediately.



    To read more about backticks, read these questions on U&L: Understanding backtick and What does ` (backquote/backtick) mean in commands?






    share|improve this answer

























    • This is a good answer but a=`echo $b` is in most cases a bad example. You will get the value of $b, with all sequences of whitespace replaced with single spaces, then each word will be expanded as a glob based on the files of the current directory, and then all trailing newlines will be trimmed, and a single newline will be added in the end. I'd say that 99.9% of the time you'd want a=$b, and the rest a=$(echo "$b") if you want a single trailing newline.

      – user000001
      May 6 at 20:59












    • Hey @user000001, thank you for your valuable comment. What about a=`expr 1 + 3` example? (Formatting in comments sucks!!!)

      – Kulfy
      May 6 at 21:04







    • 1





      Yes, that's much better, though surely someone will come along and complain that since the question is tagged [bash], you'd be using a=$((b+3)) in real code instead of expr ;)

      – user000001
      May 6 at 21:09







    • 1





      @user000001 Replaced. The question is about ``` ` ``` and >, I don't think such complain would occur ;-).

      – Kulfy
      May 6 at 21:20







    • 1





      Consider the complaint made -- we've got so many people using 1970s-era expr syntax because they're used to seeing it around so they think it's normal/expected/correct, vs standardized-since-the-1990s (and thus not at all a bashism) $(( ... )) POSIX math syntax. date is a lot more defensible as an example, since it's legitimately needed when writing code for POSIX shells (or versions of bash that aren't recent 4.x adding printf '%(...)T') today.

      – Charles Duffy
      May 6 at 21:57














    8












    8








    8







    Backticks work in pairs. Bash is waiting for you to provide another backtick to complete the command/expression.



    > is simply a prompt for newline which is determined by the value of PS2 generally defined in .bashrc.



    Whenever you hit Enter (if the command/expression is incomplete, i.e. backtick isn't closed), bash expects you to complete the command/expression either in one line or multiple lines. For example, you want to evaluate value of 'a' using expr. You can do



    $ a=`
    > expr 1 + 3`


    will be interpreted as



    $ a=`expr 1 + 3`


    So, if you want to run some command either complete the required expression or if there is no command/expression required in between backticks, refrain from using that. Another way is to use Ctrl+C, but that would be a Keyboard Interrupt and will make your command to terminate immediately.



    To read more about backticks, read these questions on U&L: Understanding backtick and What does ` (backquote/backtick) mean in commands?






    share|improve this answer















    Backticks work in pairs. Bash is waiting for you to provide another backtick to complete the command/expression.



    > is simply a prompt for newline which is determined by the value of PS2 generally defined in .bashrc.



    Whenever you hit Enter (if the command/expression is incomplete, i.e. backtick isn't closed), bash expects you to complete the command/expression either in one line or multiple lines. For example, you want to evaluate value of 'a' using expr. You can do



    $ a=`
    > expr 1 + 3`


    will be interpreted as



    $ a=`expr 1 + 3`


    So, if you want to run some command either complete the required expression or if there is no command/expression required in between backticks, refrain from using that. Another way is to use Ctrl+C, but that would be a Keyboard Interrupt and will make your command to terminate immediately.



    To read more about backticks, read these questions on U&L: Understanding backtick and What does ` (backquote/backtick) mean in commands?







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 6 at 21:19

























    answered May 6 at 20:29









    KulfyKulfy

    5,85372248




    5,85372248












    • This is a good answer but a=`echo $b` is in most cases a bad example. You will get the value of $b, with all sequences of whitespace replaced with single spaces, then each word will be expanded as a glob based on the files of the current directory, and then all trailing newlines will be trimmed, and a single newline will be added in the end. I'd say that 99.9% of the time you'd want a=$b, and the rest a=$(echo "$b") if you want a single trailing newline.

      – user000001
      May 6 at 20:59












    • Hey @user000001, thank you for your valuable comment. What about a=`expr 1 + 3` example? (Formatting in comments sucks!!!)

      – Kulfy
      May 6 at 21:04







    • 1





      Yes, that's much better, though surely someone will come along and complain that since the question is tagged [bash], you'd be using a=$((b+3)) in real code instead of expr ;)

      – user000001
      May 6 at 21:09







    • 1





      @user000001 Replaced. The question is about ``` ` ``` and >, I don't think such complain would occur ;-).

      – Kulfy
      May 6 at 21:20







    • 1





      Consider the complaint made -- we've got so many people using 1970s-era expr syntax because they're used to seeing it around so they think it's normal/expected/correct, vs standardized-since-the-1990s (and thus not at all a bashism) $(( ... )) POSIX math syntax. date is a lot more defensible as an example, since it's legitimately needed when writing code for POSIX shells (or versions of bash that aren't recent 4.x adding printf '%(...)T') today.

      – Charles Duffy
      May 6 at 21:57


















    • This is a good answer but a=`echo $b` is in most cases a bad example. You will get the value of $b, with all sequences of whitespace replaced with single spaces, then each word will be expanded as a glob based on the files of the current directory, and then all trailing newlines will be trimmed, and a single newline will be added in the end. I'd say that 99.9% of the time you'd want a=$b, and the rest a=$(echo "$b") if you want a single trailing newline.

      – user000001
      May 6 at 20:59












    • Hey @user000001, thank you for your valuable comment. What about a=`expr 1 + 3` example? (Formatting in comments sucks!!!)

      – Kulfy
      May 6 at 21:04







    • 1





      Yes, that's much better, though surely someone will come along and complain that since the question is tagged [bash], you'd be using a=$((b+3)) in real code instead of expr ;)

      – user000001
      May 6 at 21:09







    • 1





      @user000001 Replaced. The question is about ``` ` ``` and >, I don't think such complain would occur ;-).

      – Kulfy
      May 6 at 21:20







    • 1





      Consider the complaint made -- we've got so many people using 1970s-era expr syntax because they're used to seeing it around so they think it's normal/expected/correct, vs standardized-since-the-1990s (and thus not at all a bashism) $(( ... )) POSIX math syntax. date is a lot more defensible as an example, since it's legitimately needed when writing code for POSIX shells (or versions of bash that aren't recent 4.x adding printf '%(...)T') today.

      – Charles Duffy
      May 6 at 21:57

















    This is a good answer but a=`echo $b` is in most cases a bad example. You will get the value of $b, with all sequences of whitespace replaced with single spaces, then each word will be expanded as a glob based on the files of the current directory, and then all trailing newlines will be trimmed, and a single newline will be added in the end. I'd say that 99.9% of the time you'd want a=$b, and the rest a=$(echo "$b") if you want a single trailing newline.

    – user000001
    May 6 at 20:59






    This is a good answer but a=`echo $b` is in most cases a bad example. You will get the value of $b, with all sequences of whitespace replaced with single spaces, then each word will be expanded as a glob based on the files of the current directory, and then all trailing newlines will be trimmed, and a single newline will be added in the end. I'd say that 99.9% of the time you'd want a=$b, and the rest a=$(echo "$b") if you want a single trailing newline.

    – user000001
    May 6 at 20:59














    Hey @user000001, thank you for your valuable comment. What about a=`expr 1 + 3` example? (Formatting in comments sucks!!!)

    – Kulfy
    May 6 at 21:04






    Hey @user000001, thank you for your valuable comment. What about a=`expr 1 + 3` example? (Formatting in comments sucks!!!)

    – Kulfy
    May 6 at 21:04





    1




    1





    Yes, that's much better, though surely someone will come along and complain that since the question is tagged [bash], you'd be using a=$((b+3)) in real code instead of expr ;)

    – user000001
    May 6 at 21:09






    Yes, that's much better, though surely someone will come along and complain that since the question is tagged [bash], you'd be using a=$((b+3)) in real code instead of expr ;)

    – user000001
    May 6 at 21:09





    1




    1





    @user000001 Replaced. The question is about ``` ` ``` and >, I don't think such complain would occur ;-).

    – Kulfy
    May 6 at 21:20






    @user000001 Replaced. The question is about ``` ` ``` and >, I don't think such complain would occur ;-).

    – Kulfy
    May 6 at 21:20





    1




    1





    Consider the complaint made -- we've got so many people using 1970s-era expr syntax because they're used to seeing it around so they think it's normal/expected/correct, vs standardized-since-the-1990s (and thus not at all a bashism) $(( ... )) POSIX math syntax. date is a lot more defensible as an example, since it's legitimately needed when writing code for POSIX shells (or versions of bash that aren't recent 4.x adding printf '%(...)T') today.

    – Charles Duffy
    May 6 at 21:57






    Consider the complaint made -- we've got so many people using 1970s-era expr syntax because they're used to seeing it around so they think it's normal/expected/correct, vs standardized-since-the-1990s (and thus not at all a bashism) $(( ... )) POSIX math syntax. date is a lot more defensible as an example, since it's legitimately needed when writing code for POSIX shells (or versions of bash that aren't recent 4.x adding printf '%(...)T') today.

    – Charles Duffy
    May 6 at 21:57














    5














    The backticks create an execution environment called command substitution. It is used like this, for example:



    echo "The date today is `date`"


    Here, the date command is executed first, and its output replaces the part between the backticks, so in the end you get a string with the current date.



    Command substitution may span multiple lines, so when you type:



    cd `


    and press Enter, bash expects you to complete the command substitution, before executing the cd command. This can be broken either by closing the backtick and pressing Enter, or by pressing CTRL-c (This will abort the command without anything getting executed).



    Note that modern guidelines prefer to avoid the backtick syntax for command substitution, and to use $( ) instead, so the first example would be:



    echo "The date today is $(date)"





    share|improve this answer





























      5














      The backticks create an execution environment called command substitution. It is used like this, for example:



      echo "The date today is `date`"


      Here, the date command is executed first, and its output replaces the part between the backticks, so in the end you get a string with the current date.



      Command substitution may span multiple lines, so when you type:



      cd `


      and press Enter, bash expects you to complete the command substitution, before executing the cd command. This can be broken either by closing the backtick and pressing Enter, or by pressing CTRL-c (This will abort the command without anything getting executed).



      Note that modern guidelines prefer to avoid the backtick syntax for command substitution, and to use $( ) instead, so the first example would be:



      echo "The date today is $(date)"





      share|improve this answer



























        5












        5








        5







        The backticks create an execution environment called command substitution. It is used like this, for example:



        echo "The date today is `date`"


        Here, the date command is executed first, and its output replaces the part between the backticks, so in the end you get a string with the current date.



        Command substitution may span multiple lines, so when you type:



        cd `


        and press Enter, bash expects you to complete the command substitution, before executing the cd command. This can be broken either by closing the backtick and pressing Enter, or by pressing CTRL-c (This will abort the command without anything getting executed).



        Note that modern guidelines prefer to avoid the backtick syntax for command substitution, and to use $( ) instead, so the first example would be:



        echo "The date today is $(date)"





        share|improve this answer















        The backticks create an execution environment called command substitution. It is used like this, for example:



        echo "The date today is `date`"


        Here, the date command is executed first, and its output replaces the part between the backticks, so in the end you get a string with the current date.



        Command substitution may span multiple lines, so when you type:



        cd `


        and press Enter, bash expects you to complete the command substitution, before executing the cd command. This can be broken either by closing the backtick and pressing Enter, or by pressing CTRL-c (This will abort the command without anything getting executed).



        Note that modern guidelines prefer to avoid the backtick syntax for command substitution, and to use $( ) instead, so the first example would be:



        echo "The date today is $(date)"






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited May 7 at 1:37









        Kevin Bowen

        15k155972




        15k155972










        answered May 6 at 20:31









        user000001user000001

        5231413




        5231413




















            Vaishnava Hari is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Vaishnava Hari is a new contributor. Be nice, and check out our Code of Conduct.












            Vaishnava Hari is a new contributor. Be nice, and check out our Code of Conduct.











            Vaishnava Hari is a new contributor. Be nice, and check out our Code of Conduct.














            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1141052%2fcd-command-meaning-and-how-to-exit-it%23new-answer', 'question_page');

            );

            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







            Popular posts from this blog

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?