PDA

View Full Version : Shell script



Hypertext
12-08-2008, 03:06 AM
Hi there,

I am trying to write a shell script to ssh into my server then take a msg and make an svn commit. Here what I have so far:



#!/bin/bash

msg=0
echo -n "Please enter your commit message:
"
read msg


if [ $msg -eq 0 ]; then
echo "Your message was passed null, although your commit was successful"
else
echo "Commit Successful, with a message of $msg"
fi

ssh [email protected]
svn commit -m $msg


I run:
charlie-kirks-mac-pro:shl.sh charliekirk$ bash TXT.sh
Please enter your commit message:
updates to some content
TXT.sh: line 13: [: too many arguments
Commit Successful, with a message of updates to some content

then it ssh's into my server, and then leaves me hanging, what I'd like it to do, although I know my current logic doesn't make this viable, to ssh into first, then run it, but I don't know if thats possible, oh by the way ocne it does ssh in, it presents me with a bash prompt.

Want to hide these adverts? Register an account for free!