i have a homework to print the header of a shell script as help option using sed
The shell script (the correct answer from prof)
#---------------------------------------------------------------------
# File-name: <script1.sh>
# Language: bash script
# Project: Shell Script Programming Class
# Description: xyz
# Author: iamgroot
#---------------------------------------------------------------------
if [ "$1" == '-h' ] ; then
echo Help:
sed -n '/File\-name/,/A\uthor/p' "$0" | sed "s/^#//g"
exit 0
fi
The output
Help:
File-name: <script1.sh>
Language: bash script
Project: Shell Script Programming Class
Description: xyz
Author: iamgroot
I dont understand why there is \
before -name
and before uthor
(row 10 shell script)
Also why there is "$0"
(the same row)?
Any help would be appreciated