Shell Script
Info
- Place in
/usr/local/binto access easily - Add
#!/bin/shto the top of the file, t hen you don't have to add a file ending
Variables
variable="I am a variable"
other_variable=123
echo "My variables: $variable, $other_variable"
readonly_variable="xyz"
readonly readonly_variable
unset variable
User Input
# Access number of arguments
if [ $# -eq 0 ]; then
echo "No arguments supplied"
fi
# Access specific arguments
first_arg=$1
second_arg=$2
# Reading Input
read -p "Enter input: " user_input