shelllings

a practical way to learn shell
git clone https://git.davidvoz.net/shelllings.git
index
logs
tree
license

12_arguments.sh
1#!/bin/sh
2
3# When you run a shell, you can input arguments into the .sh file to be
4# used inside of it.
5#
6# $ sh test.sh file_name
7#
8# And then within test.sh, we can have code like this
9#
10# $ wc -l $1
11#
12# The arguments that can be into a script are read as follows
13#
14# $0 # the script name
15# $1 # the first argument
16# $2 # the second argument
17# $n # the nth argument
18# $@ # all arguments as separate words
19# $* # all arguments as a single word
20# $# # number of arguments passed
21#
22# Fix below if the arguments passed were: ugly Jayce smelly tofu
23
24echo "One day, [insult] [name] left a [adjective] [food] in his pocket."
25echo "A tiger smelt him and ate him."
26echo "The words you used were: $"
27echo "The number of words you used were: $"