Move under www to ease rsync
This commit is contained in:
26
www/eps/hpr2756/hpr2756_bash20_ex2.sh
Executable file
26
www/eps/hpr2756/hpr2756_bash20_ex2.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Example 2 for Bash Tips show 20: simple use of positional parameters
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# This script needs 2 arguments
|
||||
#
|
||||
if [[ $# -ne 2 ]]; then
|
||||
echo "Usage: $0 word count"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
word=$1
|
||||
count=$2
|
||||
|
||||
#
|
||||
# Repeat the 'word' 'count' times on the same line
|
||||
#
|
||||
for (( i = 1; i <= count; i++ )); do
|
||||
echo -n "$word"
|
||||
done
|
||||
echo
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user