export EDITOR=/usr/bin/vim
bind "TAB:menu-complete"
bind "set show-all-if-ambiguous on"
bind "set completion-ignore-case on"
command1 ; command2
command1 & command2
command1 && command2
command1 || command2
Can also be written as an if else statement
echo hello world
echo *
echo ~/*
$((arithmetic expression))
echo $(((5*5)+10)) is equal to 35
echo front-{A..D}-back
echo number{1..7..2}
touch {john.py,irene.py,yukio.py}
rm {john,irene,yukio}.py
echo $USER
echo $PATH
The PATH variable is very important! You'll see why soon
$(command)
echo $(ls)
sudo pacman -R $(pacman -Qdtq)
#!/bin/bash
#!/bin/bash
echo "Hello World!"
chmod +x hello_world
./hello_world
echo $PATH
export PATH=/path/you/want:$PATH
export PATH=$PATH:/path/you/want
variable=value
#!/bin/bash
title="Detailed Contents of Directory"
stuff=$(ls -alh)
echo "$title
$stuff"
command << token
text
token
#!/bin/bash
title="Detailed Contents of Directory"
stuff=$(ls -alh)
cat << _EOF_
$title
"Here is a list of"
'the contents of the pwd'
yay!
$stuff
_EOF_
# Change the redirection operator to <<- if you
# want to ignore leading tabs for formatting
Create a script that generates a System Information Page. The page should display a timestamp of when it was created (and by who), the shell you're using , how long the computer has been on, and disk space usage.
<!--The HTML skeleton-->
<html>
<head>
<title></title>
</head>
<body>
page content
goes here
</body>
</html>
function name {
commands
return
}
name() {
commands
return
}
# call functions by
# writing the name
name
source ~/.bashrc
read [-options] [variables]
#!/bin/bash
echo -n "Please enter a word: "
read word
echo $word
[ expression ]
test expression
man test
# Syntax of if statements
if commands; then
commands
elif commands; then
commands
else
commands
fi
python=5
if [ $python == 5 ]; then
echo "Python is cool"
elif [ $python == 6 ]; then
echo "Python isn't cool"
else
echo "C is annoying"
fi
true
echo $?
false
echo $?
Write a shell script that takes gives the user 5 seconds to enter a number, and then prints out whether that number is even or odd
Write a function for the above shell script that requires the user to input a predefined password to use the script
[[ expression ]]
string =~ regex where regex is an extended regular expression; used for data validation
The == operator supports pathname expansion *
Ex. if ((INT == 0)); then echo "INT is zero"; fi