This script is supposed to ssh to the server, which it does and then it supposed to say "case is correct" on the name of the server that the person entered if the case is correct (upper or lowercase).  However, it works except that it never returns a servername.  I just get "case is correct" and that's it.  I have tried exporting variables, using "do export" in the script.  Nothing works. Anyone have any clues?  If I type in harvey when it asks "please type in the server" it should return harvey if the case is correct.  Instead it returns "case is correct" and that's all.

echo -e "Please type the server: \c ":
                read servername
                for server in $servername; do ssh -t $server 'for filername in `cd /usr/openv/netbackup/db/images; 'ls'`; do if '[  -d /usr/openv/netbackup/db/images/$filername ]'; then echo -e "case is correct non $servername"; break; else echo "case incorrect"; break;fi done';done

the first for loop is useless.

your script is as messy as your post.
once you're on the server side, you can't go back to the client and again back to the server.
the "script" is sent and executed on the server.

don't use ls inside scripts, the shell has globs which are able to expand to file names.

This was pretty insulting. Just because I am a beginner you don't have to attack the post. Needless to say, I won't be posting here again. The idea that it is messy is I have never written anything in bash before, nor have I ever posted on this forum before. I guess this forum is just for experienced people.

my behaviour does not reflect the intention of the site.

your post is messy because you put it all between code tags!
nor does it have a "hello", or "thank you" !!!

you silly!

Edited 4 Years Ago by Watael

This article has been dead for over six months. Start a new discussion instead.