Skip to content
Snippets Groups Projects
Commit 9d04fc44 authored by Peng Lian's avatar Peng Lian
Browse files

Add comment mark to the parameter output

parent b9d4ab49
No related merge requests found
......@@ -38,7 +38,7 @@ while [[ $# -gt 0 ]]; do
shift # past value
;;
-*|--*)
echo "Unknown option $1"
echo "# Unknown option $1"
exit 1
;;
*)
......@@ -53,16 +53,16 @@ set -- "${POSITIONAL_ARGS[@]}"
# display the captured arguments
# the options
echo "p1 = ${PARA1}"
echo "p2 = ${PARA2}"
echo "# p1 = ${PARA1}"
echo "# p2 = ${PARA2}"
# capture the non-optional argument, if it exists
if [[ -n $1 ]]; then
echo "The non-optional/last argument = $1"
echo "# The non-optional/last argument = $1"
# run word count example
if [[ -f $1 ]]; then
cat "$1" | tr "[a-z]" "[A-Z]" | tr -cs "A-Z'" "\012" | sort | uniq -c | sort -n -r
else
echo "File ($1) doesn't exist!"
echo "# File ($1) doesn't exist!"
fi
fi
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment