-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for the number of supplied arguments
- Loading branch information
1 parent
bd1d33a
commit de51313
Showing
7 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
#!/bin/sh | ||
|
||
# SSH into an Ubuntu VM. This script accepts the IP address of the VM | ||
# instance as a parameter. | ||
ssh -i ../config/test.pem -l ubuntu $1 | ||
# SSH into a VM instance. | ||
|
||
if [ $# -ne 2 ] | ||
then | ||
echo "You must specify two arguments:" | ||
echo "(1) the username corresponing to the ../config/test.pem key" | ||
echo "(2) the IP address of the VM instance" | ||
exit 1 | ||
fi | ||
|
||
ssh -i ../config/test.pem -l $1 $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
#!/bin/sh | ||
|
||
# Attach the created volume to an Ubuntu VM instance as /dev/vdc. This | ||
# script accepts a volume ID as a parameter. | ||
nova volume-attach ubuntu $1 /dev/vdc | ||
# Attach the created volume to a VM instance as /dev/vdc. | ||
|
||
if [ $# -ne 2 ] | ||
then | ||
echo "You must specify two arguments:" | ||
echo "(1) the name of the VM instance" | ||
echo "(2) the ID of the volume to attach" | ||
exit 1 | ||
fi | ||
|
||
nova volume-attach $1 $2 /dev/vdc |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
|
||
# This script prepends the license header provided in the | ||
# license-header file to the file specified as an argument if the | ||
# header has not yet been prepended. | ||
|
||
DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
SOURCE=${DIR}/license-header-sh | ||
|
||
TARGET_LINE1=`cat $1 | sed '1!d;q'` | ||
TARGET_LINE2=`cat $1 | sed '2!d;q'` | ||
TARGET_LINE3=`cat $1 | sed '3!d;q'` | ||
|
||
SOURCE_LINE1=`cat $SOURCE | sed '1!d;q'` | ||
SOURCE_LINE2=`cat $SOURCE | sed '2!d;q'` | ||
SOURCE_LINE3=`cat $SOURCE | sed '3!d;q'` | ||
|
||
echo $TARGET_LINE1 | ||
echo $TARGET_LINE2 | ||
echo $TARGET_LINE3 | ||
|
||
echo $SOURCE_LINE1 | ||
echo $SOURCE_LINE2 | ||
echo $SOURCE_LINE3 | ||
|
||
if [ $TARGET_LINE1 != $SOURCE_LINE1 -o $TARGET_LINE2 != $SOURCE_LINE2 -o $TARGET_LINE2 != $SOURCE_LINE2 ] | ||
then | ||
echo "not equal -> replacing" | ||
sed -i 's/#!\/bin\/sh//g' $1 | ||
|
||
cp $1 /tmp/out | ||
cat $SOURCE > $1 | ||
cat /tmp/out >> $1 | ||
rm -f /tmp/out | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters