Store command in a Var problem

Hi!

I strated to script since 1 month and I don't have much expirience but this thing here is strange

I have a script where I want to store a svn command in a var to check it later
so it's like this

#!/bin/sh
list=`ssh itadmin@192.168.1.200 "ls /home/svn"` # this stores the list of repositories and works fine
projname=`zenity --entry --text "$list

Enter the project name that you want to create "` # this ask to the user to insert the name of the project according to the list and works fine
version= `ssh itadmin@192.168.1.200 "svnadmin verify /home/svn/$projname"` # this one, when I use the script in the terminal, it prompts me the right thing but it seams that the var version doesn't receive the content of the command
echo "Project name: "$projname # here I do a echo just to confirme that the $projname is well stored
echo "Version control revision: "$version # and here the echo shows the $version empty!!

Maybe I can't use version to receive the command???
please help

thanks

try to delete the "space" after "version= command" to "version=command" and have a look if this works...

Gaves me the same, but thanks

ok, try to debug your script some more with setting the "set -xv" option on second line of your file. run the script and have a look for yourself or post the output here...

Sorry for late responce but I had a metting
this is what the script gave me:

  • Verified revision 0.
  • Verified revision 1.
  • Verified revision 2.
    Project name: repos
    Version control revision:

so, the 1,2 and 3 line are the verbose from the (version= `ssh itadmin@192.168.1.200 "svnadmin verify /home/svn/$projname"`)
which means that the command works but the var version doesn't receive nothing couse in the last line (echo "Version control revision: "$version) the var is empty

Please help
thanks

Redirect the svn's STDERR output to STDOUT with:

"svnadmin verify /home/svn/$projname 2>&1"

sorry but I don't understand your code. Can you be more expecific for my example? I'm still a beginer

Replace

version= `ssh itadmin@192.168.1.200 "svnadmin verify /home/svn/$projname"` # this one, when I use the script in the terminal, it prompts me the right thing but it seams that the var version doesn't receive the content of the command

with

version= `ssh itadmin@192.168.1.200 "svnadmin verify /home/svn/$projname 2>&1"` 

bash: -c: line 0: syntax error near unexpected token `newline'
bash: -c: line 0: `svnadmin verify /home/svn/repos 2>'
Version control revision:

worse than before

Try:

version= `ssh itadmin@192.168.1.200 '"svnadmin verify /home/svn/$projname 2>&1"'`

It's a quoting problem. Note the single quotes before the first double quote and after the last double quote.

Man sorry but your thing is still wrong

Check this. If when I use:

it works
when I do:

it works
when I do

from the command line it works but doesn't store in the var. Man it seams that everything is ok but doesn't work and I'm very upset with this

but thanks

On the command line, do:

svnadmin verify /home/svn/$projname 2>/dev/null

What do you get?

I don't receive nothing. Executes but nothing in the verbose.
This is very strange. I have to continue my project and forget this for some time.
but thanks anyway

That's what I expected. It outputs to standard error (STDERR). The answer I gave you earlier (with 2>&1 )should work.