It is currently Sat May 26, 2018 9:17 pm

Basic Test Script

All times are UTC - 6 hours

Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Sun Feb 27, 2011 9:14 pm   

Joined: Mon May 31, 2010 7:40 pm
Posts: 25
First post here and I belive this is where the very basic questions go, so.

I have a script where I check if a directory exists. If not, then it creates the directory, changes into the directory and initiates an sftp session to download files.

My only concern with it is on the last read (read answer) it actually displays the option I chose which is no big deal and thinking about this, I really don't care that it does this.

Well, I am wondering if someone can take a look at it and tell me how I can improve it or make suggestions?



sftp () {
    /usr/bin/sftp [email protected]

makedir () {
    mkdir $HOME/$number

echo -n "enter the last four digits of the case number "

read number

if [ ! -d $HOME/$number ]; then
    echo "directory does not exist, now creating directory..."
cd "$HOME/$number"
    echo "directory exists..."
    echo "do you want to initiate sftp y/n"
        read answer
    if  [[ $answer == [yY] ]];then
cd "$HOME/$number"
        echo "goodbye..."
exit 1

I just noticed that when testing with FTP the script works as I am prompt to enter my credentials. However, whilst using sftp it just loops and I am somewhat lost as to why it does this?

I determined it sitting in a loop by running bash - x

and all I saw was the lines sftp over and over again.

Will continue troubleshooting this issue.

I corrected the issue above by providing the full path to sftp.
Thank you!

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 6 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group