Difference between revisions of "User:XiX/Bash"
(5 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | '''Bash''', which stands for '''B'''ourne-'''A'''gain '''SH'''ell, is one of the most popular 'shells' today. 'Shells' are command-line interpreters that process user input, and they are arguably the single most powerful tool at your disposal while operating a Linux platform. Understanding Bash, or any shell for that matter, is therefore highly recommended for both efficiency benefits and your understanding of the Linux platform itself. Before we begin, it's important for you to recognize that unlike MS-DOS, Bash is case-sensitive. That is, 'ID' will be interpreted differently than 'id', so ensure that you are using the correct case before executing a command. To start with, you can find Bash on most modern OS's like so: | + | '''Bash''', which stands for '''B'''ourne-'''A'''gain '''SH'''ell, is one of the most popular 'shells' today. 'Shells' are command-line interpreters that process user input, and they are arguably the single most powerful tool at your disposal while operating a Linux platform. Understanding Bash, or any shell for that matter, is therefore highly recommended for both efficiency benefits and your understanding of the Linux platform itself. Before we begin, it's important for you to recognize that unlike MS-DOS, Bash is case-sensitive. That is, 'ID' will be interpreted differently than 'id', so ensure that you are using the correct case before executing a command. To start with, you can find Bash on most modern [[Operating System|OS's]] like so: |
{| style="color:lime;background-color:black;" cellpadding="10" cellspacing="0" border="1" width="100%" | {| style="color:lime;background-color:black;" cellpadding="10" cellspacing="0" border="1" width="100%" | ||
Line 15: | Line 15: | ||
|} | |} | ||
− | + | The advent of Bash ushered in new features to modern shells. You may have recognized one already, when we ran 'echo $SHELL'. Bash supports internal variables, such as the '$SHELL' variable. Most variables are set by the shell, however you can set them yourself. To set a variable: | |
+ | |||
+ | {| style="color:lime;background-color:black;" cellpadding="10" cellspacing="0" border="1" width="100%" | ||
+ | |Description | ||
+ | |Command | ||
+ | |Example output | ||
+ | |- | ||
+ | |Setting a variable | ||
+ | |NAME='XiX' | ||
+ | |No output | ||
+ | |- | ||
+ | |Using a variable | ||
+ | |echo Hey $NAME | ||
+ | |Hey XiX | ||
+ | |- | ||
+ | |Show all variables | ||
+ | |set | ||
+ | |Output too extensive | ||
+ | |} | ||
+ | |||
+ | Using commands like 'set' and 'echo' are part of a series of commands known as 'Bash builtins'. Bash builtins are tasks that can be performed independent of the host OS. A full list of Bash builtins can be found [http://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html here]. |
Latest revision as of 16:15, 28 July 2012
Bash, which stands for Bourne-Again SHell, is one of the most popular 'shells' today. 'Shells' are command-line interpreters that process user input, and they are arguably the single most powerful tool at your disposal while operating a Linux platform. Understanding Bash, or any shell for that matter, is therefore highly recommended for both efficiency benefits and your understanding of the Linux platform itself. Before we begin, it's important for you to recognize that unlike MS-DOS, Bash is case-sensitive. That is, 'ID' will be interpreted differently than 'id', so ensure that you are using the correct case before executing a command. To start with, you can find Bash on most modern OS's like so:
Description | Command | Example output |
Find out what shell you are actively using | echo $SHELL | /bin/bash |
Locate Bash | which bash | /bin/bash |
The advent of Bash ushered in new features to modern shells. You may have recognized one already, when we ran 'echo $SHELL'. Bash supports internal variables, such as the '$SHELL' variable. Most variables are set by the shell, however you can set them yourself. To set a variable:
Description | Command | Example output |
Setting a variable | NAME='XiX' | No output |
Using a variable | echo Hey $NAME | Hey XiX |
Show all variables | set | Output too extensive |
Using commands like 'set' and 'echo' are part of a series of commands known as 'Bash builtins'. Bash builtins are tasks that can be performed independent of the host OS. A full list of Bash builtins can be found here.